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

相关推荐
一路向北North13 分钟前
网页版预编译SQL转换工具
前端·javascript·sql
小羊失眠啦.30 分钟前
用 Rust 实现高性能并发下载器:从原理到实战
开发语言·后端·rust
拿不拿铁191 小时前
Vite 5.x 开发模式启动流程分析
前端
fruge1 小时前
设计稿还原技巧:解决间距、阴影、字体适配的细节问题
前端·css
BBB努力学习程序设计2 小时前
了解响应式Web设计:viewport网页可视区域
前端·html
zhangyao9403302 小时前
uni-app scroll-view特定情况下运用
前端·javascript·uni-app
码农张2 小时前
从原理到实践,吃透 Lit 响应式系统的核心逻辑
前端
jump6802 小时前
object和map 和 WeakMap 的区别
前端
打小就很皮...2 小时前
基于 Dify 实现 AI 流式对话:组件设计思路(React)
前端·react.js·dify·流式对话
这个昵称也不能用吗?2 小时前
【安卓 - 小组件 - app进程与桌面进程】
前端