如何清除NPM之前的ssl代理设置? 嗯,我搜索了很多,但我得到的所有帖子主要是关于如何在公司网络中设置代理。

我试图设置代理为空:

npm config set http-proxy
npm config set https-proxy

第一个命令传递,第二个命令警告说:

npm WARN invalid config proxy=""
npm WARN invalid config Must be a full url with 'http://'

警告是否可忽略,我是否已成功清除代理设置?


当前回答

这对我有用

proxy=http://<username>:<pass>@proxyhost:<port>

https-proxy=http://<uname>:<pass>@proxyhost:<port>

示例在我的实例用户名:uname和密码:pword

npm config set proxy=http://uname:pword@192.168.5.8:8080

npm config set https-proxy=http://uname:pword@192.168.5.8:8080

其他回答

好的,“NPM config delete…”是Windows环境的正确命令,反之亦然,“NPM config rm…”是类unix环境的正确命令。 此外,至少对我来说,必须添加“-g”选项,因为该命令可以正常工作

得到完全相同的问题,我一直看到我的代理配置,即使删除npmrc文件和删除键。

我发现npm默认使用windows env key http-proxy。

所以进入计算机->属性->高级系统设置->环境变量,检查是否配置了http-代理密钥。

如果你浏览npm配置文档,它说:

代理 默认值:HTTP_PROXY或HTTP_PROXY环境变量 零 类型:url

因此,要禁用代理的使用,代理设置必须设置为空。要将代理值设置为空,必须确保没有设置HTTP_PROXY或HTTP_PROXY环境变量。所以取消设置这些环境变量,并确保npm config ls -l显示proxy = null。

此外,重要的是要注意:

仅删除http_proxy和https_proxy配置设置不会 帮助,如果你仍然有HTTP_PROXY或HTTP_PROXY环境变量 设置为什么和 设置注册表使用http://和Setting 如果您没有使用代理,那么对false的严格ssl将对您没有帮助 不管怎样,让HTTP_PROXY设置为某个值。

如果npm把代理的类型设置为布尔值来开启/关闭代理的使用,那就更好了。或者,它们可以引入一个新的boolean类型的use_proxy排序设置。

这是

npm config delete http-proxy
npm config delete https-proxy

npm config rm proxy
npm config rm https-proxy

set HTTP_PROXY=null
set HTTPS_PROXY=null

这对我有用

proxy=http://<username>:<pass>@proxyhost:<port>

https-proxy=http://<uname>:<pass>@proxyhost:<port>

示例在我的实例用户名:uname和密码:pword

npm config set proxy=http://uname:pword@192.168.5.8:8080

npm config set https-proxy=http://uname:pword@192.168.5.8:8080