运行npm install -g @ angular / cli时出错

问题描述 投票:0回答:1

如何解决问题,请提供帮助。(如果是这种情况,互联网连接速度非常慢,是否比最低要求还高?)C:\ Windows \ system32>节点-vv12.16.2C:\ Windows \ system32> npm -v6.14.4C:\ Windows \ system32> npm install -g @角/ clinpm ERR!解析'... r \ n“}附近的JSON输入时意外结束,” deprecated“:”`'

C:\Windows\system32> node -v
v12.16.2
C:\Windows\system32> npm -v
6.14.4
C:\Windows\system32> npm install -g @angular/cli
npm ERR! Unexpected end of JSON input while parsing near '...r\n"},"deprecated":"`'
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\shafin\AppData\Roaming\npm-cache\_logs\2020-04-23T03_28_52_255Z-debug.log
PS C:\Windows\system32> npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
PS C:\Windows\system32> npm install -g @angular/cli
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/@angular%2fcli (over 
 30000ms)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\shafin\AppData\Roaming\npm-cache\_logs\2020-04-23T03_30_39_498Z-debug.log


log file details are bellow:
0 info it worked if it ends with ok
1 verbose cli [
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'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session aaee446bfd2a465d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/@angular%2fcli 40063ms
8 http fetch GET 200 https://registry.npmjs.org/@angular/cli/-/cli-9.1.3.tgz 5183ms
9 silly pacote tag manifest for @angular/cli@latest fetched in 45301ms
10 timing stage:loadCurrentTree Completed in 45326ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 2ms
16 silly install loadAllDepsIntoIdealTree
17 silly resolveWithNewModule @angular/[email protected] checking installable status
18 http fetch GET 200 https://registry.npmjs.org/inquirer 9945ms
.....
89 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program 
    Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
90 verbose node v12.16.2
91 verbose npm  v6.14.4
92 error Response timeout while trying to fetch (https://registry.npmjs.org/ansi-colors) (over `enter 
 code here`30000ms)
93 verbose exit [ 1, true ]
angular angular-cli angular-cli-v7 angular-cli-v8
1个回答
0
投票
如果担心时间问题,您应该找到npm安装的速度解决方案。因此,您可以尝试使用比npm install更快的命令:

pnpm install %70 faster

npm install --no-audit 15% faster

npm install --prefer-offline --no-audit 15% faster

© www.soinside.com 2019 - 2024. All rights reserved.