NPM, YARN配置淘宝镜像

人盡茶涼 提交于 2019-12-05 03:02:03

这个也是网上搜的,亲自试过,非常好用!

一、npm设置淘宝镜像

1.通过config命令

安装完node后建议设置npm镜像以加速后面的过程(或使用科学上网工具)。注意:不要使用cnpm!cnpm安装的模块路径比较奇怪,packager不能正常识别!

npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
npm info underscore (如果上面配置正确这个命令会有字符串response)

搜索镜像: https://npm.taobao.org

 

二、yarn设置淘宝镜像

1.通过config命令

安装完yarn后同理也要设置镜像源:

yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global

yarn config get registry (如果上面配置正确这个命令会输出淘宝镜像地址)

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!