Visual Studio 中设置npm

VS2017自带的npm会去国外的镜像下载文件, 奇慢无比, 还是马云家淘宝的镜像适合国内用户.

 

淘宝npm镜像地址:  https://registry.npm.taobao.org

 


 

VS中使用淘宝npm镜像, 需要以下两步:

 

步骤1.  修改npm config, 指向淘宝npm镜像, 有3种方法:   

 

1.通过config命令

 

npm config set registry https://registry.npm.taobao.org 

 

 

npm info underscore (如果上面配置正确这个命令会有字符串response

 

 

2.命令行指定

 

npm --registry https://registry.npm.taobao.org info underscore 

 

 

3.编辑  ~/.npmrc 加入下面内容

 

registry = https://registry.npm.taobao.org

 

步骤2.  修改 VS 的 Web Package Management

            如图, 添加以下三项, 然后就可以愉快的在VS中使用淘宝npm镜像了.

 

posted @ 2018-01-07 20:21  杨浪  阅读(6451)  评论(3编辑  收藏  举报