npm修改镜像源
1. 临时使用
在 npm install XXX 时加入--registry URL即可,不会影响到本地配置,如:
npm --registry https://registry.npm.taobao.org install express
2. 持久使用
永久修改本地npm的配置:
npm config set registry https://registry.npm.taobao.org
3. 其他命令
查看npm源地址有没有换成功:
npm config get registry
重置为官方源:
npm config set registry https://registry.npmjs.org/
转载于:https://blog.csdn.net/l464278441/article/details/114405263#:~:text=npm%E4%BF%AE%E6%94%B9%E9%95%9C%E5%83%8F%E6%BA%90%201%201.%20%E4%B8%B4%E6%97%B6%E4%BD%BF%E7%94%A8%20%E5%9C%A8%20npm%20install%20XXX,npm%20config%20set%20registry%20https%3A%20%2F%2F%20registry.npmjs.org%20%2F