01.基础使用
1 添加安装包
1.1 从github直接添加安装包
To add yarn package from Githubm,you need to use this command:
$ yarn add <Github user name>/<Github repository name>
If youginterested in a specific barnch or commit, you need to run the command:
$ yarn add <Github user name >/<Github repository name>#<branch/commit/tag>
1.2 从通过gitpkg中间打包下载
格式为:
$ yarn add https://gitpkg.now.sh/[username]/[repository]/[...subDir]
如:
$ yarn add https://gitpkg.now.sh/wuchuhengtools/vuepress-theme-reco -D # 安装仓库
$ yarn add https://gitpkg.now.sh/wuchuhengtools/vuepress-theme-reco/packages/vuepress-theme-reco -D # 安装仓库下的子目录
2 yarn
全局安装包找不到的问题?
找出包安装包的bin
启动目录
$ export PATH="$(yarn bin):$PATH"
$ export PATH="$(yarn global bin):$PATH"
以上的路径不一定对,最终以全局安装包的实际.bin
目录为准,写入.bashrc
或.zshrc
3 代理
$ # 设置
$ npm config set proxy=http://<host>:<port>
$ npm confit set https-proxy http://<username:password@><host>:<port>
$ # 重置
$ npm config delete proxy
$ npm config delete https-proxy
4 靠谱源
$ npm config set registry https://registry.npm.taobao.org
$ # 官方源
$ npm config delete registry