errors when running npm install -g @angular/cli

503 views Asked by At

How to solve the issue please help. (is that about very slow internet connection if that was the case than what's the min requirement?) 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":"`'

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 ]
1

There are 1 answers

6
Rahul Purohit On

İf its abaut the timing problem you should find a speed solutions for npm install. So you can try these faster command than npm install :

pnpm install 

or

npm install --no-audit

or

npm install --prefer-offline --no-audit