npm ERR! code E407 Proxy Authentication Required

泪湿孤枕 提交于 2020-01-21 20:50:07

问题


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 npm@6.4.1
3 info using node@v10.15.3
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 ]

回答1:


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/



来源:https://stackoverflow.com/questions/55222110/npm-err-code-e407-proxy-authentication-required

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!