npm 更换阿里云镜像

来源:https://blog.csdn.net/a249040113/article/details/81567430

npm安装插件过程:从http://registry.npmjs.org下载对应的插件包(该网站服务器位于国外,所以经常下载缓慢或出现异常)

阿里在国内搭建了镜像服务器:http://npm.taobao.org 

需要执行以下命令更改:

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

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

更改完成

使用 命令  npm config get registry 查看本地镜像源

也可以使用下面方式

npm install cnpm -g -registry=https://registry.npm.taobao.org

部分机器出错

解决方法:直接更新openssl 

yum update openssl -y

完成再次install cnpm即可

cnpm等同于npm命令.用法一样

猜你喜欢

转载自www.cnblogs.com/zouhao/p/12038279.html
今日推荐