Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to npm install Angular-cli after proxy configuration

I am trying to download Angular in Windows 10 using npm install. As I am on corporate proxy, I configured the proxy to username:password@server:port

However, I am facing this issue when running

npm ERR! code E407 npm ERR! 407 Proxy Authorization Required: @angular/cli@latest

The debug log as followed:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   '--proxy',
1 verbose cli   'http://XXXXX',     //Removed my proxy details
1 verbose cli   '--without-ssl',
1 verbose cli   '--insecure',
1 verbose cli   '-g',
1 verbose cli   'install',
1 verbose cli   '@angular/cli' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 40ab1dc3dabb6029
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 407 http://registry.npmjs.org/@angular%2fcli 109ms
8 silly fetchPackageMetaData error for @angular/cli@latest 407 Proxy Authorization Required: @angular/cli@latest
9 verbose stack Error: 407 Proxy Authorization Required: @angular/cli@latest
9 verbose stack     at fetch.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
9 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
9 verbose stack     at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
9 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
9 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
9 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
9 verbose stack     at Async._drainQueue (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
9 verbose stack     at Async._drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
9 verbose stack     at Immediate.Async.drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
9 verbose stack     at runCallback (timers.js:785:20)
9 verbose stack     at tryOnImmediate (timers.js:747:5)
9 verbose stack     at processImmediate [as _immediateCallback] (timers.js:718:5)
10 verbose cwd C:\Users\XXXXX
11 verbose Windows_NT 10.0.14393
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "--proxy" "http://XXXXX" "--without-ssl" "--insecure" "-g" "install" "@angular/cli"
13 verbose node v8.8.1
14 verbose npm  v5.4.2
15 error code E407
16 error 407 Proxy Authorization Required: @angular/cli@latest
17 verbose exit [ 1, true ]

Any idea what could have cause the issue? Thanks!

like image 448
icedmilocode Avatar asked Dec 04 '25 18:12

icedmilocode


1 Answers

This configuration worked for me :

method1 (command line):

npm config set proxy http://user:password@domain_proxy:port/
npm config set https-proxy http://user:password@domain_proxy:port

be careful the url should be encoded. for example this password 01xx!tr should be introduced as 01xx%21tr. use this site to encode your url https://www.url-encode-decode.com/

example:
user/password => user1/01xx!tr
domain:port of the proxy => mydomain.org:8000
=> in that case :

npm config set proxy http://user1:01xx%[email protected]:8000/
npm config set https-proxy http://user1:01xx%[email protected]:8000

method2 (edit node conifugration file):

the method 2 is easier because we will not be botherd with encoding the urls

1- edit node configuration file (in windows it's located in %USERPROFILE%\.npmrc, example C:\Users\Jack\.npmrc)

2- add these lines
proxy=http://user:password@domain_proxy:port/
https-proxy=https-proxy http://user:passwor`enter code here`d@domain_proxy:port

example :
if the :
user/password => user1/01xx!tr
domain:port of the proxy => mydomain.org:8000

=> the configuration file should be look like this:

proxy=http://user1:[email protected]:8000/
https-proxy=http://user1:[email protected]:8000
like image 174
Ala Messaoudi Avatar answered Dec 06 '25 09:12

Ala Messaoudi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!