0

如何解决问题,请帮忙。(如果是这样的话,互联网连接速度是否比最低要求要慢?) 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 错误!在 '...r\n"},"deprecated":"`' 附近解析时 JSON 输入意外结束

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 npm@6.14.4
3 info using node@v12.16.2
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/cli@9.1.3 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 ]
4

1 回答 1

0

如果它解决了时间问题,您应该为 npm install 找到一个速度解决方案。所以你可以试试这些比 npm install 更快的命令:

pnpm install 

或者

npm install --no-audit

或者

npm install --prefer-offline --no-audit  
于 2020-04-23T04:57:43.720 回答