0%

node 包管理工具: npm 与 yarn

资源

安装

安装 yarn

1
npm install yarn -g

代理

设置代理

1
2
3
4
5
6
#npm
npm config set proxy http://127.0.0.1:1080
npm config set https-proxy http://127.0.0.1:1080
# yarn
yarn config set proxy http://127.0.0.1:1080
yarn config set https-proxy http://127.0.0.1:1080

删除代理

1
2
3
4
5
6
#npm
npm config delete proxy
npm config delete https-proxy
# yarn
yarn config delete proxy
yarn config delete https-proxy

镜像

ref: https://npm.taobao.org/mirrors

nvm

1
2
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
export NVM_IOJS_ORG_MIRROR=http://npm.taobao.org/mirrors/iojs
1
2
3
4
5
npm config set registry https://registry.npm.taobao.org -g
npm config set disturl https://npm.taobao.org/dist -g
npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
1
2
3
4
5
yarn config set registry https://registry.npm.taobao.org -g
yarn config set disturl https://npm.taobao.org/dist -g
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g