I am trying to set NPM (v9.4.0) proxy but I am facing the following error when running npm i -g npm@latest
:
npm ERR! code E407
npm ERR! 407 Proxy Authentication Required: npm@latest
The password I use for the proxy contains an "@" character an I suspect this is the root cause of the issue. I tried with a "\" before the "@" and also
npm config set proxy http://"user:MyP@ssword"@proxy.big.corp.fr:8080
npm config set https-proxy http://"user:MyP@ssword"@proxy.big.corp.fr:8080
but without success. Does anyone have an idea?
After many research about this problem and test more than 10 solutions like set with this commands:
npm config set proxy "http://domain%5Cusername:password@servername:port/"
but not worked for me.
then test CNTLM but CNTLM didn't work for me. I tried all possible combinations. NPM was giving Authentication error.
finally i test Fiddler and saved my time. It is easy to install and configure. Open Fiddler => Rule => Automatically Authenticated.
Open C:\Users\your username\.npmrc file and use this configurations
registry=http://registry.npmjs.org
proxy=http://127.0.0.1:8888
https-proxy=http://127.0.0.1:8888
http-proxy=http://127.0.0.1:8888
strict-ssl=true
remove npm folder in this path C:\Users\your username\AppData\Roaming.
Using following command:
npm install express
npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli
I checked and found, in my company, an anonymous proxy exists. This also solved my problem.
You can also convert your password to BASE64 encode
npm config set proxy http://<user>:<base64 password>@proxy.big.corp.fr:8080
Sample:
npm config set proxy http://myuser:bXlwYXNzd29yZA==@proxy.big.corp.fr:8080
To convert use site https://www.base64encode.org/