gpt4 book ai didi

node.js - 不使用 http ://before the proxy server name 设置 npm 代理

转载 作者:搜寻专家 更新时间:2023-10-31 23:18:41 25 4
gpt4 key购买 nike

我已经安装了 npm 并使用了几次,但不幸的是我不得不更改我的代理并且我无法让它再次工作。

这是我过去的设置:(有效的)

npm 配置获取代理:http://proxy-foo.foobar.com:8080

npm config get https-proxy: http://proxy-foo.foobar.com:8080

现在我的代理是一个服务器名称,当我在浏览器中使用代理时它工作正常,但是当我在 npm 中设置配置时它失败并显示“getaddrinfo ENOTFOUND”

当前设置:

npm 配置获取代理:http://servername:8080

npm config get https-proxy: http://servername:8080

在我的浏览器代理中,我没有在服务器名称前使用 http://,我认为这是导致它失败的原因。这可能是问题所在吗?如果是的话,有没有办法在 npm 中设置代理配置,而无需之前使用 http://。

最佳答案

你是对的; npm(更准确地说,request,它实际上执行抓取)确实关心之前的http://代理名称。

proxy 设置应该是您可以在浏览器中访问的完全限定的 URL,例如,

http://proxy.company.com:port/

http://1.1.1.1:1234/

如果指定为 IP 地址。

关于node.js - 不使用 http ://before the proxy server name 设置 npm 代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14818564/

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