npm设置代理

npm设置仓库
1.npm config set registry https://registry.npm.taobao.org
npm config list #查看npm当前配置

2.命令行指定
每次执行命令前加入–registry指定仓库路径
npm --registry http://172.17.216.121 install

3.编辑 ~/.npmrc 加入下面内容
registry = https://registry.npm.taobao.org

或者使用nrm(npm registry 管理工具 nrm, 能够查看和切换当前使用的registry,就是说nrm是一个管理npm的工具)

1.nrm add dir XXX(地址)

2.nrm use dir(即使用上面dir的地址作为npm registry的的地址,等同于设置了仓库地址,但是切换更加方便)

3.nrm ls(查看所有可以切换的地址)

设置好后直接使用npm install即可

 

posted @ 2019-09-02 19:00  jim520  阅读(4346)  评论(0编辑  收藏  举报