npm改为淘宝镜像

1.npm config ls  //查看npm的配置文件

会发现里面的registry是npm原始的镜像:https://registry.npmjs.org/

2.永久修改为淘宝镜像。

npm config set registry https://registry.npm.taobao.org
npm i -g express
修改完成后,可以用下列命令行,查看是否成功:
npm config get registry

把npm的镜像完全设为了淘宝的镜像,万一我们有些依赖包只有npm原始镜像里面才有,而淘宝里面没有,那就悲剧了。所以分开npm和cnpm是最好的

3.从淘宝镜像改为原始的镜像
npm config set registry https://registry.npmjs.org/

猜你喜欢

转载自www.cnblogs.com/kingsmart/p/12759035.html