Yarn是Facebook推出的,一个可能取代npm的新型包管理器
安装
推荐使用npm命令进行安装,前提是你使用了淘宝镜像,这样可以将网络影响减小到最低
npm install -g yarn
替换镜像
查看当前仓库地址
$ yarn config get registry
-> https://registry.yarnpkg.com
替换成淘宝的镜像
$ yarn config set registry 'https://registry.npm.taobao.org'
yarn config v1.3.2
success Set "registry" to "https://registry.npm.taobao.org".
✨ Done in 0.03s.
然后 yarn install 的速度就快多了
参考文章:《yarn 和 npm 都换成 淘宝镜像,就飞起来了》
顺便附上npm设置淘宝npm镜像命令
npm config set registry http://registry.npm.taobao.org
cnpm
alias cnpm="npm --registry=http://registry.cnpmjs.org --cache=$HOME/.npm/.cache/cnpm"