npm config set registry https://registry.npmmirror.com/ ---阿里镜像源
npm config set registry https://npm.tuna.tsinghua.edu.cn----清华镜像源
-- 配置后可通过下面方式来验证是否成功 npm config get registry -- 显示出上述地址的话就是更换成功 npm config set proxy http://<proxy-server>:<port> npm config set https-proxy http://<proxy-server>:<port>
有时候,清理npm的缓存可以解决一些奇怪的连接问题:
npm cache clean --force 报错:
network This is a problem related to network connectivity
解决方案:
①进行代理设置为false,如下命令
npm config set proxy false
②npm缓存清理,如下命令
npm cache verify
③再次执行npm install命令即可解决此问题
报错:
npm ERR! the command again as root/Administrator.