解决npm问题:错误的代理设置

错误的代理设置

复制代码
npm install vue-waterfall-plugin-next
npm ERR! code ECONNREFUSED
npm ERR! syscall connect
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npmmirror.com/vue-waterfall-plugin-next failed, reason: connect ECONNREFUSED 127.0.0.1:31181
npm ERR!     at ClientRequest.<anonymous> (F:\Tools\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR!     at ClientRequest.emit (node:events:517:28)
npm ERR!     at onerror (F:\Tools\nodejs\node_modules\npm\node_modules\agent-base\dist\src\index.js:117:21)
npm ERR!     at callbackError (F:\Tools\nodejs\node_modules\npm\node_modules\agent-base\dist\src\index.js:136:17)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR!  FetchError: request to https://registry.npmmirror.com/vue-waterfall-plugin-next failed, reason: connect ECONNREFUSED 127.0.0.1:31181
npm ERR!     at ClientRequest.<anonymous> (F:\Tools\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR!     at ClientRequest.emit (node:events:517:28)
npm ERR!     at onerror (F:\Tools\nodejs\node_modules\npm\node_modules\agent-base\dist\src\index.js:117:21)
npm ERR!     at callbackError (F:\Tools\nodejs\node_modules\npm\node_modules\agent-base\dist\src\index.js:136:17)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '127.0.0.1',
npm ERR!   port: 31181,
npm ERR!   type: 'system',
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '127.0.0.1',
npm ERR!   port: 31181,
npm ERR!   type: 'system',
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '127.0.0.1',
npm ERR!   port: 31181,
npm ERR!   type: 'system',
npm ERR!   syscall: 'connect',
npm ERR!   address: '127.0.0.1',
npm ERR!   port: 31181,
npm ERR!   type: 'system',
npm ERR!   type: 'system',
npm ERR!   requiredBy: '.'
npm ERR! }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: F:\Tools\nodejs\node_cache\_logs\2025-02-20T01_02_46_768Z-debug-0.log

遇到此问题是因为 npm 配置了错误的代理设置,导致尝试通过本地未被监听的端口(127.0.0.1:31181)进行连接。以下是分步解决方案:

步骤 1:清除 npm 的代理配置

在命令行中执行以下命令,移除可能存在的代理设置:

bash 复制代码
npm config delete proxy
npm config delete https-proxy

步骤 2:检查环境变量中的代理设置

确保没有设置 HTTP_PROXYHTTPS_PROXY 环境变量。在 Windows 的 CMD 中运行:

cmd 复制代码
set HTTP_PROXY
set HTTPS_PROXY

如果发现这些变量被设置,需要取消设置。在 CMD 中:

cmd 复制代码
set HTTP_PROXY=
set HTTPS_PROXY=

在环境变量中将 HTTP_PROXY和 HTTPS_PROXY 删除

重新npm install xxx 即可成功。

相关推荐
前端橙一陈1 天前
LocalStorage Token vs HttpOnly Cookie 认证方案
前端·spring boot
~无忧花开~1 天前
JavaScript学习笔记(十五):ES6模板字符串使用指南
开发语言·前端·javascript·vue.js·学习·es6·js
泰迪智能科技011 天前
图书推荐丨Web数据可视化(ECharts 5)(微课版)
前端·信息可视化·echarts
CodeCraft Studio1 天前
借助Aspose.Email,使用 Python 读取 Outlook MSG 文件
前端·python·outlook·aspose·email·msg·python读取msg文件
家里有只小肥猫1 天前
react 初体验2
前端·react.js·前端框架
慧慧吖@1 天前
前端发送请求时,参数的传递格式
前端
L李什么李1 天前
HTML——使用表格制作简历
前端·javascript·html
未来之窗软件服务1 天前
万象EXCEL开发(八)excel公式解析与依赖映射 ——东方仙盟金丹期
前端·excel·仙盟创梦ide·东方仙盟·万象excel
linuxxx1101 天前
ajax() 回调函数参数详解
前端·ajax·okhttp
王嘉俊9251 天前
ThinkPHP 入门:快速构建 PHP Web 应用的强大框架
开发语言·前端·后端·php·框架·thinkphp