npm install 出错,‘proxy‘ config is set properly. See: ‘npm help config‘

背景

从远程clone下项目之后,使用命令 npm install 安装依赖,报错如下

意为:

bash 复制代码
报错:
npm犯错!network与网络连通性有关的问题。 
npm犯错!网络在大多数情况下,你背后的代理或有坏的网络设置。 
npm犯错!网络 npm犯错!网络如果你是一个代理,请确保 npm犯错!网络"代理"配置设置正确。
参见:'npm help config'
原因:

后台设置的proxy代理环境有问题,可能会有缓存

解决办法:

可以关闭代理然后清理代理环境在进行下载

  1. 设置代理关闭
bash 复制代码
npm config set proxy false
  1. 清除缓存
bash 复制代码
npm cache clean

注意,如果出现:清除缓存时报错,如下所示:

bash 复制代码
npm ERR! As of npm@5, the npm cache self-heals from corruption issues 
npm ERR!   by treating integrity mismatches as cache misses.  As a result, 
npm ERR!   data extracted from the cache is guaranteed to be valid.  If you 
npm ERR!   want to make sure 

则使用强制清除缓存指令

bash 复制代码
npm cache clean --force

注意:若是显示

bash 复制代码
npm WARN using --force Recommended protections disabled.

则继续执行

bash 复制代码
npm cache verify

则可清理缓存成功

或者也可以降低npm的版本,因为安装的npm版本过高

降低npm的命令使用如下

bash 复制代码
#6.14.10为版本号,也可以更改
npm install npm@6.14.10 -g 

然后删除 node_modules, 重新npm install即可。

相关推荐
非优秀程序员7 分钟前
第10章 千团出世|《互联网产品恩仇录》
前端
非优秀程序员12 分钟前
第11章 小高在对面|《互联网产品恩仇录》
前端
非优秀程序员12 分钟前
第14章 只剩美团|《互联网产品恩仇录》
前端
非优秀程序员14 分钟前
第09章 老乡何必为难老乡|《互联网产品恩仇录》
前端
非优秀程序员24 分钟前
第03章 三大门户,烽烟起于瀛海威|《互联网产品恩仇录》
前端
非优秀程序员38 分钟前
第02章 杭电的英语老师与一台服务器|《互联网产品恩仇录》
数据库·node.js·代码规范
周杰伦的稻香1 小时前
Hexo 腾讯视频追剧页插件:hexo-tengxun-eucalyptus 安装使用
npm
曦樂~4 小时前
【Web Development】02 CSS
前端·css
风骏时光牛马5 小时前
后端服务接口开发与数据逻辑处理
前端
东鹏特饮5 小时前
经典打砖块(Breakout)游戏
前端·css·css3