首先不推荐使用Ubuntu默认的yarn安装,版本太低。
- 首先在Ubuntu的源中添加yarn的源地址
1
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
1
echo "deb https://dl.yarnpkg.com/debian/ rc main" | sudo tee /etc/apt/sources.list.d/yarn.list
记得分两次输入
- 进行安装
1
sudo apt-get update && sudo apt-get install yarn
Ubuntu 17.04 默认安装有cmdtest,会影响正常的Yarn安装,请在之前先卸载
1 | sudo apt remove cmdtest |
- 查看版本
1
yarn --version
windows安装的时候经常提示
1 | There appears to be trouble with your network connection. Retrying... |
进行修改源
1 | yarn config set registry https://registry.npm.taobao.org |
就可以正常安装相应的包了