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:[email protected]:8080 npm config set https-proxy http://myusername:[email protected]:8080 npm config set strict-ssl false

What else can I try?

2

4 Answers 4

10

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.

2
  • This works for me. May I know what is the magic behind the hit URL in IE? Sep 21, 2018 at 8:42
  • Is there something that we need to do with that JSON that appears in the browser? Sep 18, 2023 at 20:15
4

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

NPM behind NTLM proxy

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.

0
1

I have the same issue. The root cause is my password contains a special character '#', when I npm set config proxy, the character becomes '#' in the .npmrc file, so I escape the special character or change my password to remove the special character and it's working fine. If your password does not contain special characters, just use the syntax command below to escape, 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,

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.