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

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


当前回答

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

其他回答

请参阅文件C:\Users\myusers.中的npm设置npmrc文件。有时npm代理配置设置不适用。所以值得一查。

以上这些对我都不起作用。我不得不编辑文件。”Npmrc”将在用户主目录下(例如:c:\users\abcuser):

http_proxy=null
registry=https://registry.npmjs.org/
strict-ssl=true
proxy=null

试试这个,

NPM删除http代理

NPM删除http -proxy

NPM配置rm代理

NPM配置rm http -proxy

设置HTTP_PROXY = null

设置HTTPS_PROXY = null

在我的情况下(基于Ubuntu的Linux Mint 16),我必须:

NPM配置删除http -proxy 清除https_proxy Bash环境参数——奇怪的是,尽管我在任何地方都找不到这个行为,npm回退到https_proxy: $ http_proxy= " https_proxy= " NPM config get http -proxy 零 $ http_proxy= " xxhttps_proxy= " NPM config get http -proxy https://1.2.3.4:8080

从npm中删除任何配置的最简单方法是编辑npm配置文件。只需要两(2)个命令就可以做到这一点;一个用于打开NPM配置文件进行编辑,另一个用于确认您的更改。

输入NPM config list查看所有激活的NPM配置的列表。 输入NPM config edit打开带有NPM配置的文本编辑器。 删除代理行(或简单地将其注释掉)。 保存并关闭配置文件。 输入NPM配置列表以确认代理配置已被删除。

这就是生活!

我尝试了此页上列出的所有东西,没有工作,然后我尝试了配置编辑。它立刻起作用了。(我用的是Windows 10)