Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! code E407 Proxy Authentication Required

While I am trying to run npm command, I am getting an error.

The error log is reproduced below:

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   'install',
1 verbose cli   'graph' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 7743923ae4798761
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 407 https://registry.npmjs.org/graph 7681ms
8 silly fetchPackageMetaData error for graph@latest 407 Proxy Authentication Required: graph@latest
9 timing stage:rollbackFailedOptional Completed in 9ms
10 timing stage:runTopLevelLifecycles Completed in 8056ms
11 verbose stack Error: 407 Proxy Authentication Required: graph@latest
11 verbose stack     at fetch.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
11 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
11 verbose stack     at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
11 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
11 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
11 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
11 verbose stack     at Async._drainQueue (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
11 verbose stack     at Async._drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
11 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
11 verbose stack     at runCallback (timers.js:705:18)
11 verbose stack     at tryOnImmediate (timers.js:676:5)
11 verbose stack     at processImmediate (timers.js:658:5)
12 verbose cwd C:\Windows\system32
13 verbose Windows_NT 6.1.7601
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "graph"
15 verbose node v10.15.3
16 verbose npm  v6.4.1
17 error code E407
18 error 407 Proxy Authentication Required: graph@latest
19 verbose exit [ 1, true ]
like image 595
Sajid Baloch Avatar asked Mar 18 '19 13:03

Sajid Baloch


People also ask

What is proxy authentication required?

What Does Proxy Authentication Required Mean? The 407 Proxy Authentication Required error code indicates that the server cannot complete the request because the client lacks appropriate authentication credentials for a proxy server that intercepts the request between the client and server.


1 Answers

This error is most likely because you are behind a proxy, or may be you are in your organisation which uses proxy. To find the PROXY name and the PORT you need to do the following steps:
1.go to run
2.type "inetcpl.cpl"
3.Go to Connection tab
4. Go to LAN Setting There you will find address and the port

After you get the "address" and the "port" replace it with "proxy_name" and "port" in the below command and replace "username" with "your username" and "password" with "your password" and run

npm config set proxy http://username:password@proxy_name:port

npm config set http-proxy http://username:password@proxy_name:port

Afterwards run npm.

This should work possibly

Edit: Before running npm config the URL should be encoded and this can be done by just copy pasting the URL to this website https://www.urlencoder.io/

like image 88
Ashish Johnson Avatar answered Oct 16 '22 16:10

Ashish Johnson