npm报错‘proxy‘ config is set properxy. See: ‘npm help config‘

1 报错信息

复制代码
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ETIMEDOUT: request to https://registry.npmjs.org/vue-ref failed, reason: connect ETIMEDOUT 104.16.20.35:443 npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation. npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to https://registry.npmjs.org/dom-closest failed, reason: connect ETIMEDOUT 104.16.22.35:443 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'

2 解决方案

step1 查代理
npm config get proxy
npm config get npm config get https-proxy
npm config get registry

step2 存在代理,缓存置空
npm config set proxy null
npm config set https-proxy null

step3 配置一个镜像源(选一个进行配置)

淘宝源:
npm config set registry http://registry.npm.taobao.org/

官方源:
npm config set registry http://registry.npmjs.org/

华为源
npm config set registry https://mirrors.huaweicloud.com/repository/npm/

其他命令:
npm cache clean
npm rebuild node-sass

相关推荐
我命由我123453 小时前
CesiumJS 笔记 - 获取容器中心点、Cartesian3 clone 方法、修改 Cartesian3 对象的高度
前端·javascript·css·前端框架·html·html5·js
Hopebearer_4 小时前
页面突然只剩 DOM?一次静态资源版本错配排查
前端·部署
东风破_4 小时前
ESLint 是什么?为什么你的项目需要它?
前端·后端·代码规范
圣殿骑士-Khtangc6 小时前
Go字符串高效拼接性能对比与底层原理分析
服务器·前端·golang
BigTopOne7 小时前
【ijkplayer】 硬解码流程
前端
kyriewen7 小时前
DeepSeek Harness开源第一天我就上手了——和Claude Code的差距比想象中大
前端·ai编程·deepseek
捡田螺的小男孩7 小时前
什么是 Skill?手把手带你写一个简单有用的 Skill!
前端·后端·程序员
IT_陈寒8 小时前
Redis集群这个坑,差点让我通宵
前端·人工智能·后端
90后的晨仔8 小时前
uni-app 路由跳转与页面导航 —— 终极详解(对标 iOS / Android / 鸿蒙三端原生)
前端
Heo8 小时前
大厂前端调试不能只会debugger
前端·javascript·面试