6

I am trying to install bower

npm install -g bower

but am getting an authentication error from our proxy

... npm http 407 http://registry.npmjs.org/bower ... Error Code: 407 Proxy Authentication Required. ...

I am trying to get npm working behind a corprate proxy. I think our proxy is a little weird because the only way I was able to get maven downloading packages was to add wagon-http-lightweight.jar as a maven extension.

http://maven.apache.org/wagon/wagon-providers/wagon-http-lightweight/

I have tried all the regular things as described here: Is there a way to make npm install (the command) to work behind proxy?

(I don't need to supply authentication details in my maven proxy settings).

npm config set registry http://registry.npmjs.org/ npm config set proxy http://myusername:mypassword@proxy.us.somecompany:8080 npm config set https-proxy http://myusername:mypassword@proxy.us.somecompany:8080 npm config set strict-ssl false

What else can I try?

4

4 回答 4

9

可以试试这个....为我工作。

  • 打开 IE(Chrome 对我不起作用)。
  • 点击网址http://registry.npmjs.org
  • 如果成功,它将下载 json 输出。

现在返回命令提示符并尝试 npm install。

于 2018-02-06T16:05:54.670 回答
4

我能够通过安装本地代理来完成这项工作:

NTLM 代理背后的 NPM

于 2013-11-11T10:18:19.700 回答
3

使用 fiddler http://www.telerik.com/fiddler 安装并运行就是这样,一切都会按预期运行。我花了半天时间研究这个编辑:老实说,我不知道它是 fiddler 还是我尝试过的其他东西来修复它(主要是后者),但你应该尝试设置注册表、http-proxy、proxy 和 strict -ssl

当 HTTP 代理需要认证时:

Fiddler 可以配置为使用 NTLM 或其他协议对公司 HTTP 代理进行身份验证。保留现有的自动身份验证选项/规则默认值。相反,请从菜单栏中转到此设置:

工具 > Telerik Fiddler 选项 > 连接选项卡

单击允许远程计算机连接复选框。您将看到一个对话框,解释启用此选项的后果。如上所示,重新启动 Fiddler 并更新.npmrc文件。每当您需要 npm 访问注册表站点时,只需运行 Fiddler。此设置不会影响 Fiddler 为其他捕获运行的方式。

于 2014-09-26T10:13:45.290 回答
2

我有同样的问题。根本原因是我的密码包含一个特殊字符“#”,当我 npm set config proxy 时,该字符在 .npmrc 文件中变为“#”,所以我更改了密码以删除特殊字符,它工作正常。如果您的密码不包含特殊字符,只需使用下面的语法命令即可。

npm config set strict-ssl=false
npm config set proxy http://<username>:<password>@<proxy-server-url>:<port>
npm config set https-proxy http://<username>:<password>@<proxy-server-url>:<port>

谢谢,

于 2018-10-16T04:42:19.860 回答