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?

Community
  • 1
  • 1
jax
  • 37,735
  • 57
  • 182
  • 278
  • possible duplicate of [Node.js, NPM, proxy and node\_modules](http://stackoverflow.com/questions/17996200/node-js-npm-proxy-and-node-modules) – Joe Nov 08 '13 at 00:10
  • use this [solution](https://stackoverflow.com/questions/48224025/npm-behind-a-proxy-with-the-character-in-my-password/50214574#50214574). it worked for me. – saeid mohammad hashem May 07 '18 at 12:57

4 Answers4

9

Can try this....working for me.

  • Open IE (Chrome did not work for me).
  • Hit the URL http://registry.npmjs.org
  • it will download json output if successful.

Now go back to command prompt and try npm install.

hbthanki
  • 549
  • 1
  • 7
  • 11
4

I was able to get this working by installing a local proxy:

NPM behind NTLM proxy

Community
  • 1
  • 1
jax
  • 37,735
  • 57
  • 182
  • 278
3

Use fiddler http://www.telerik.com/fiddler Install and run and that's it, everything will run as it is supposed to. I spent half a day cracking my head on this Edit: I honestly have no idea if it was fiddler or something else I tried that fixed it (it is mostly the latter) but you should try setting registry, http-proxy, proxy and strict-ssl

When authentication is required for the HTTP proxy:

Fiddler can be configured to authenticate with the corporate HTTP proxy using NTLM or other protocols. Leave the existing auto authenticate options/rules defaults in place. Instead, go to this setting from the menu bar:

Tools > Telerik Fiddler Options > Connections tab

Click on the Allow remote computers to connect checkbox. You will see a dialog explaining the consequences of enabling this option. Restart Fiddler and update the .npmrc file as shown above. Whenever you need npm to access the registry site just run Fiddler. This setting won't affect the way Fiddler runs for other captures.

Sixto Saez
  • 12,610
  • 5
  • 43
  • 51
EmptyCup
  • 421
  • 4
  • 14
2

I have the same issue. The root cause is my password contains a special character '#', when I npm set config proxy, the character become '#' in .npmrc file, so I change my password to remove the special character and it's working fine. If your password does not contains special characters, just use syntax command below, it will work.

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>

Thanks,

Do Tat Hoan
  • 901
  • 9
  • 9
  • There is a thread in Stack Over Flow already resolve this issue by encode the special character in here: https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password – Do Tat Hoan Dec 12 '18 at 08:03