npm设置为永久淘宝镜像

5,802 阅读1分钟

1、临时使用
npm --registry https://registry.npm.taobao.org install express
2、永久使用
npm config set registry https://registry.npm.taobao.org
通过如下命令可以查看是否配置成功

npm config get registry
npm info express

如果需要恢复成原来的官方地址只需要执行如下命令
npm config set registry https://registry.npmjs.org
3、使用cnpm
安装淘宝的cnpm,然后在使用时直接将npm命令替换成cnpm命令即可
npm install -g cnpm --registry=https://registry.npm.taobao.org
然后安装时使用如下命令
cnpm install express

作者:Cola丶ZYQ
链接:www.jianshu.com/p/857c7410b…
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。