安装依赖时报错:If you are behind a proxy, please make sure that the ‘proxy’ config...

执行:npm install 时,报错:If you are behind a proxy, please make sure that the ‘proxy’ config is set properly.


错误意思:npm错误! 网络如果是一个代理,请确保 npm错误!网络“代理”配置设置正确. 参见: npm help config

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

方法一:可以关闭代理然后清理代理环境再进行下载

#1. 设置代理关闭
npm config set proxy false
或更改为淘宝镜像 (查看当前镜像源:npm config get registry // 默认情况下是官方默认全局镜像源: https://registry.npmjs.org)
npm config set registry https://registry.npmmirror.com/

#2. 清除缓存
npm cache clean 
#若清除失败则使用强制清除缓存指令
npm cache clean --force

#3.  执行安装命令
npm i

方法二:检查 npm 代理设置,删除掉 npm 代理设置

#1. 检查 NPM 代理设置
npm config get proxy
npm config get https-prox

#2. 删除掉 NPM 代理设置
npm config rm proxy  
npm config rm https-proxy

#3. 再次检查 NPM 代理设置
npm config get proxy

#再次执行安装命令安装依赖
npm i

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值