Reputation: 95
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!
Upvotes: 2
Views: 48238
Reputation: 4032
Solved it. After I spent a bit of time on proxy issues, it turns out my mistake was setting 3 proxy variables: proxy, http-proxy and https-proxy.
(note: I read somewhere on stackoverflow that I was supposed to set http-proxy but this is wrong)
Removing http-proxy solved this for me.
Setting npm proxy and npm https_proxy is correct, as follows:
npm config set proxy http://user:[email protected]:port/
npm config set https-proxy http://user:[email protected]:port/
Upvotes: 1
Reputation: 109
To config proxy in office,
npm config set proxy http://user:[email protected]:port/
npm config set https-proxy http://user:[email protected]:port/
Upvotes: 0
Reputation: 1
The thing that worked for me as below, Issue: Registry defined at "C:\Users*user-name*.npmrc" was wrong. Need to update npm config registry.
Step 1 Solution: Removed registry entry from "C:\Users*user-name*.npmrc" file.
Step 2 After Step 1 I got below error
npm install -g @angular/cli npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning SELF_SIGNED_CERT_IN_CHAIN: request to https://registry.npmjs.org/@angular%2fcli failed, reason: self signed certificate in certificate chain npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
Issue: The npm maintainers announced on February 27th that npm’s Self-Signed Certificate is No More: A bunch of users received a “SELFSIGNEDCERTINCHAIN” error during installing and publishing packages throughout the day today. npm no longer supports its self-signed certificates. However, the recommended fix failed for me.
Solution: Open command prompt, and run below commands. SETLOCAL SET npm_config_strict-ssl=false npm install npm -g --ca=null npm --version ENDLOCAL
Step 3 Now >npm install -g @angular/cli running all ok.
Upvotes: 0
Reputation: 1
This steps worked for me
Edit .npmrc
file
add below lines
proxy=http://username:password@proxyaddress:portno
https-proxy=http://username:password@proxyaddress:portno
Upvotes: 0
Reputation: 755
If you have configured Proxy and Still you are not able to install using npm command. You can try below command. It seemed you need to clear some stuff - and that will fix the issue.
npm cache verify
Upvotes: 0
Reputation: 366
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
Upvotes: 10
Reputation: 1392
Try making the URL of npm registry to http instead of https. You can take a look at this answer.
Upvotes: 0