如何清除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://'

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


当前回答

如果你浏览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排序设置。

其他回答

This was already answered but I think the --global config is not covered properly. By running npm config rm proxy you remove proxy from user configuration. This can be easily verified by running: npm config list. If there is proxy or https-proxy setting set in global config you have to use --global in the command to remove it. So at the end this will clean-up proxies from both local and global configs: npm config rm proxy npm config rm https-proxy npm config --global rm proxy npm config --global rm https-proxy

以上这些方法对我都没有帮助,但下面这条有用:

npm config rm proxy
npm config rm https-proxy

来源:http://jonathanblog2000.blogspot.ch/2013/11/set-and-reset-proxy-for-git-and-npm.html

试试这个,

NPM删除http代理

NPM删除http -proxy

NPM配置rm代理

NPM配置rm http -proxy

设置HTTP_PROXY = null

设置HTTPS_PROXY = null

好吧,我要把这个放在这里因为我在NPM上遇到了很大的麻烦。

我试图改变一个代理设置使用npm配置设置代理“http://..。然后运行NPM config get proxy。它总是返回一个错误的值,不同于我设置的值。

我发现我在项目上有一个.npmrc committed,我试图运行npm install,这个文件覆盖了我自己的配置。

所以它正在清除代理值,但我还需要更改文件夹项目中的.npmrc。

从那以后,一切都很顺利。

执行NPM配置列表 它将列出所有代理的值。在我的情况下,代理值从全局NPMRC文件中获取,删除它,并能够在我的Windows机器上完成NPM安装