npm切换淘宝源

约 1 分钟阅读
web开发
npm

npm

设置淘宝源

Terminal window
npm config set registry http://registry.npm.taobao.org

设置为官方源

Terminal window
npm config set registry https://registry.npmjs.org

查看当前源

Terminal window
npm get registry

使用代理

必须要是科学上网,并且工具在你的本地机器上开启了一个第三方服务器

Terminal window
npm config set proxy http://127.0.0.1:1080 # 1080是端口号

取消代理

Terminal window
npm config delete proxy

yarn

设置淘宝源

Terminal window
yarn config set registry https://registry.npm.taobao.org/

设置为官方源

Terminal window
yarn config set registry https://registry.npmjs.org

查看当前源

Terminal window
yarn config get registry

使用代理

Terminal window
yarn config set proxy http://127.0.0.1:1080 # 1080是端口号

取消代理

Terminal window
yarn config delete proxy

各种源地址

Terminal window
npm --- https://registry.npmjs.org/
cnpm --- https://r.cnpmjs.org/
taobao --- https://registry.npm.taobao.org/
nj --- https://registry.nodejitsu.com/
rednpm --- https://registry.mirror.cqupt.edu.cn/
npmMirror --- https://skimdb.npmjs.com/registry/
deunpm --- http://registry.enpmjs.org/

转载协议

本文采用 CC BY-NC-SA 4.0 协议进行许可,转载请注明出处。

允许转载、修改和分享,但必须注明作者和出处,且不得用于商业用途,衍生作品需采用相同协议。