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

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


当前回答

Http模块已弃用,并被HttpClient取代。

将导入更改为从'@angular/common/http'导入{HttpClientModule};

其他回答

这对我有用

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代理。

npm config delete proxy
npm config delete https-proxy

您可以从.npmrc文件中手动删除代理和http -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

在我的情况下,(windows操作系统),把所有这些命令列出后,npm继续采取 Windows注册表设置中的代理

\ HKEY_CURRENT_USER \环境

只要删除代理设置,在那之后,我重启电脑,然后“npm install”为我工作

例子