npm 错误!错误:尝试更新 npm 时连接 ECONNREFUSED

新手上路,请多包涵

我正在尝试使用以下命令更新 npm(节点包管理器):

npm 安装 npm@latest -g

但我在命令提示符中收到以下错误:

 npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "npm@latest" "-g"

npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect

npm ERR! Error: connect ECONNREFUSED xxx.xxx.xx.xxx:xxx
npm ERR!     at Object.exports._errnoException (util.js:1022:11)
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'

有人知道这到底意味着什么吗?

任何帮助,将不胜感激。

原文由 NickJS 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.1k
2 个回答

尝试:

 npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.npmjs.org/

前两行将删除代理(如果有)。

第三行将使 npm 从官方包注册表下载。

原文由 Ridd 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进