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

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


当前回答

我为此纠结了很久。我最后做的是进入.npmrc文件(可以在用户的目录中找到,后面跟着用户名,例如。C:\Users\erikj/.npmrc),用文本编辑器打开它,手动删除任何代理设置,并将http://设置更改为https://.在这种情况下,这是一个试验是否http或https对你有效的问题。对我来说,https是有效的。图。

其他回答

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

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

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

在windows 7中运行npm 2.10.1版本,我使用:

npm config delete proxy
npm config delete https-proxy

在我的情况下(基于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 config rm proxy
npm config rm https-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