简体   繁体   English

npm 错误! 代码 E407 需要代理身份验证

[英]npm ERR! code E407 Proxy Authentication Required

While I am trying to run npm command, I am getting an error.当我尝试运行 npm 命令时,出现错误。

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 ]

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 1.去跑步
2.type "inetcpl.cpl" 2.输入“inecpl.cpl”
3.Go to Connection tab 3.转到连接选项卡
4. Go to LAN Setting There you will find address and the port 4. 转到 LAN 设置 在那里你会找到地址和端口

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获得“地址”和“端口”后,在下面的命令中将其替换为“proxy_name”和“端口”,并将“用户名”替换为“您的用户名”,将“密码”替换为“您的密码”并运行

npm config set proxy http://username:password@proxy_name:port npm 配置集代理http://username:password@proxy_name:port

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

Afterwards run npm.然后运行 ​​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/编辑:在运行 npm config 之前,应该对 URL 进行编码,这可以通过将 URL 复制粘贴到本网站https://www.urlencoder.io/ 来完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM