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

相关推荐
ttod_qzstudio3 分钟前
CSS改变图片颜色方法介绍
前端·css
curdcv_po24 分钟前
我接入了微信小说小程序官方阅读器
前端·微信小程序
程序员鱼皮32 分钟前
什么是 RESTful API?凭什么能流行 20 多年?
前端·后端·程序员
www_stdio41 分钟前
让大语言模型拥有“记忆”:多轮对话与 LangChain 实践指南
前端·langchain·llm
inferno41 分钟前
JavaScript 基础
开发语言·前端·javascript
cindershade1 小时前
Intersection Observer 的实战方案
前端
青莲8431 小时前
Kotlin Flow 深度探索与实践指南——中部:实战与应用篇
android·前端
cindershade1 小时前
事件委托(Event Delegation)的原理
前端
开发者小天1 小时前
React中useMemo的使用
前端·javascript·react.js
1024肥宅1 小时前
JS复杂去重一定要先排序吗?深度解析与性能对比
前端·javascript·面试