查看“︁Node.js/yarn”︁的源代码
来自康健生活
←
Node.js/yarn
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 安装 == centos {{shc|<syntaxhighlight lang="bash"> npm install -g yarn</syntaxhighlight>|#}} mac {{shc|<syntaxhighlight lang="bash"> curl -o- -L https://yarnpkg.com/install.sh | bash</syntaxhighlight>}} == 源 == === 配置源 === 查询当前使用的镜像源 {{shc|<syntaxhighlight lang="bash"> yarn config get registry</syntaxhighlight>|$|/home/kangkk}} 设置源 {{shc|<syntaxhighlight lang="bash"> yarn config set registry <registry-url> </syntaxhighlight>|$|/home/kangkk}} {| class="wikitable" |- | 淘宝镜像源 || https://registry.npmmirror.com/ |- | 腾讯云镜像源 || https://mirrors.cloud.tencent.com/npm/ |- | 官方镜像源 || https://registry.yarnpkg.com/ |} === 源工具 === {{shc|<syntaxhighlight lang="bash"> npm install -g yrm</syntaxhighlight>|$|/home/kangkk}} == 配置文件 == {| class="wikitable" |- | <nowiki><2.0</nowiki> || https://classic.yarnpkg.com/en/docs/yarnrc |- | <nowiki>>=2.0</nowiki> || https://yarnpkg.com/configuration/manifest |} === .yarnrc === 可以指定包的源 {{hc|head=.yarnrc(<2.0)|output=<syntaxhighlight lang="bash"> # .yarnrc # 设置域的指定源 "@babel:registry" "https://mirrors.huaweicloud.com/repository/npm/" "registry" "http://mirrors.cloud.tencent.com/npm/" </syntaxhighlight>}} {{hc|head=.yarnrc(>=2.0)|output=<syntaxhighlight lang="bash"> # .yarnrc.yml # # 设置域的指定源 "npmScopes": "babel": "npmRegistryServer": "https://mirrors.huaweicloud.com/repository/npm/" "npmRegistryServer": "http://mirrors.cloud.tencent.com/npm/" </syntaxhighlight>}} == 添加 == === 指定包 === 指定版本号 {{shc|<syntaxhighlight lang="bash"> yarn add package-name # 安装最新版本 yarn add package-name@0.0.1 # 安装指定版本 yarn add package-name@tag # 安装指定标识版本 </syntaxhighlight>|$|/home/kangkk}} 指定路径 {{shc|<syntaxhighlight lang="bash"> yarn add package-name # 指定配置源安装,也可 package.json 指定源安装 yarn add file:/path/to/local/folder # 指定本地文件系统里安装,可用这种方式来测试还未发布的包 yarn add file:/path/to/local/tarball.tgz # 指定本地文件系统里安装压缩包 yarn add <git remote url> # 指定远程 git repo 安装 yarn add <git remote url> # 指定远程 git repo 安装,可指定 git <branch/commit/tag> yarn add https://x.y/package.tgz # 指定远程 gzipped 压缩包安装。 </syntaxhighlight>|$|/home/kangkk}} === 二进制文件 === <pre> # 指定sass的二进制文件下载 sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ # 指定electron的二进制文件下载 electron_mirror=https://npm.taobao.org/mirrors/electron/ 类似还有 --canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas </pre> == 代理 == == 更新依赖 == {{shc|<syntaxhighlight lang="bash"> yarn upgrade-interactive --latest</syntaxhighlight>|$}}
此页面嵌入的页面:
模板:Hc
(
查看源代码
)
模板:Hc/style.css
(
查看源代码
)
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
返回
Node.js/yarn
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。