gpt4 book ai didi

node.js - npm install -> 无法建立隧道套接字

转载 作者:太空宇宙 更新时间:2023-11-03 22:54:36 27 4
gpt4 key购买 nike

此错误消息已在 Stack Overflow 上多次得到解答,但所有解决方案均不适用于我。

每当我执行npm install时,我都会收到以下消息:

npm ERR! network tunneling socket could not be established, statusCode=407
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is 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'

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Repos\[repo-name]
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! code ECONNRESET

以前可以用很多次,但突然就不行了。我记得唯一改变的是我安装了 VMWare Player。但我不明白为什么这是相关的。

有时,消息会显示 cause=Parse Error,而不是 statusCode=407

我尝试过以下方法:

  • 使用 npm config set proxynpm config set https-proxy 设置代理
  • 将注册表更改为 http://registry.npmjs.org
  • strict-ssl 设置为 false
  • 使用 npm cache clean 清除 npm 的缓存

我别无选择

最佳答案

如果您使用代理,您必须:

npm config set proxy https://username:password@proxy:port

npm config set https-proxy https://username:password@proxy:port

如果您不使用用户名和密码,只需在命令行命令中避免使用“用户名:密码@”即可。

关于node.js - npm install -> 无法建立隧道套接字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26053879/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com