npm 镜像源的设置和删除

技术

npm查看源:

1
npm config get registryCopy

或者

1
npm config listCopy

设置成淘宝源:

1
npm config set registry https://registry.npm.taobao.org/Copy

设置成npm官方源:

1
npm config set registry https://registry.npmjs.org/Copy

或者暴力还原,使用rm 命令:

1
npm config rm registry

补充:下方热心网友提供

1
2
3
4
5
6
# 设置 npm 源
npm config set registry 'https://registry.npm.taobao.org'
# 设置 Electron 源
export ELECTRON_MIRROR='https://npm.taobao.org/mirrors/electron/'
# 设置 node sass 源
export SASS_BINARY_SITE='https://npm.taobao.org/mirrors/node-sass'

本文作者:Konger

本文链接: https://blog.ninglans.top/posts/1478/

评论