当我尝试使用以下命令安装Angular CLI时: npm install -g @ angular / cli
它向我显示此错误:
rollbackFailed可选:动词npm-session 1a71d92fb103bc6
为什么会出现此问题,如何解决?
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 '-g',
1 verbose cli '@angular/cli' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose npm-session 22a3a53f3067ed30
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for @angular/cli@latest request to http://registry.npmjs.org/@angular%2fcli failed, reason: connect ETIMEDOUT 104.16.18.35:80
8 timing stage:rollbackFailedOptional Completed in 2ms
9 timing stage:runTopLevelLifecycles Completed in 133557ms
10 verbose type system
11 verbose stack FetchError: request to http://registry.npmjs.org/@angular%2fcli failed, reason: connect ETIMEDOUT 104.16.18.35:80
11 verbose stack at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
11 verbose stack at ClientRequest.emit (events.js:189:13)
11 verbose stack at Socket.socketErrorListener (_http_client.js:392:9)
11 verbose stack at Socket.emit (events.js:189:13)
11 verbose stack at emitErrorNT (internal/streams/destroy.js:82:8)
11 verbose stack at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
11 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
12 verbose cwd C:\Users\Administrator
13 verbose Windows_NT 6.3.9600
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
15 verbose node v10.15.3
16 verbose npm v6.4.1
17 error code ETIMEDOUT
18 error errno ETIMEDOUT
19 error network request to http://registry.npmjs.org/@angular%2fcli failed, reason: connect ETIMEDOUT 104.16.18.35:80
20 error network This is a problem related to network connectivity.
20 error network In most cases you are behind a proxy or have bad network settings.
20 error network
20 error network If you are behind a proxy, please make sure that the
20 error network 'proxy' config is set properly. See: 'npm help config'
21 verbose exit [ 1, true ]
答案 0 :(得分:0)
尝试ping npm注册表:
> ping registry.npmjs.org
> npm view npm version
您需要检查连接或禁用防火墙,如果ping不成功,则。