yarn 的安装和使用

Yarn是Facebook最近发布的一款依赖包安装工具。
Yarn是一个新的快速安全可信赖的可以替代NPM的依赖管理工具

快速安装:

npm install -g yarn

macos上:

curl -o- -L https://yarnpkg.com/install.sh | bash

Linux上:

sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
然后
sudo apt-get update && sudo apt-get install yarn

windows 下需要下载msi文件 ,下载地址:https://yarnpkg.com/latest.msi
关于安装,你可以去官网查看到更多资料 https://yarnpkg.com/en/docs/install

测试yarn版本:

yarn --version

配置淘宝镜像源:yarn config set registry https://registry.npm.taobao.org/

查看配置列表:yarn config list

设置全局目录:yarn config set global-folder "xxx"
修改全局安装目录的bin目录位置, bin目录需要自己创建, 而且需要把此目录加到系统环境变量

# 会自动设置成*globalin 
yarn config set prefix "D:RTEYarnglobal"

修改 yarn 缓存目录:

yarn config set cache-folder "D:RTEYarncache"

https://www.cnblogs.com/hellomrr/p/13237653.html

原文地址:https://www.cnblogs.com/wbyixx/p/11944890.html