当我尝试运行npm命令时,我会遇到错误。
错误日志将在下面复制:
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 Filesnodejsnode_modulesnpmnode_modulespacotelibfetchersregistryfetch.js:42:19)
11 verbose stack at tryCatcher (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleaseutil.js:16:23)
11 verbose stack at Promise._settlePromiseFromHandler (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleasepromise.js:512:31)
11 verbose stack at Promise._settlePromise (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleasepromise.js:569:18)
11 verbose stack at Promise._settlePromise0 (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleasepromise.js:614:10)
11 verbose stack at Promise._settlePromises (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleasepromise.js:693:18)
11 verbose stack at Async._drainQueue (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleaseasync.js:133:16)
11 verbose stack at Async._drainQueues (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleaseasync.js:143:10)
11 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (C:Program Filesnodejsnode_modulesnpmnode_modulesbluebirdjsreleaseasync.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:Windowssystem32
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.跑步
2.型" inetcpl.cpl"
3.到达连接选项卡
4.转到LAN设置在那里您会找到地址和端口
在以下命令中获得"地址"one_answers" port"端口后用" proxy_name"one_answers" port"替换为" proxy_name"one_answers" port",然后用"您的用户名"one_answers"密码"替换为"用户名",然后运行
npm配置设置代理http://用户名:password@proxy_name:port
npm配置设置http-proxy http://用户名:password@proxy_name:port
之后运行npm。
这应该可能起作用
编辑:在运行NPM配置之前,应编码URL,这可以通过将URL粘贴到本网站https://www.urlencoder.io/