6

I try to install node_module in my angular project what I downloaded, but I get this error:

npm ERR! registry error parsing json

Then i reinstall npm using npm intall npm -g and after when i try use npm install I get this error:

(node:11252) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: ENOENT: no such file or directory, stat
'C:\Users\User\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-ec5da46c\angular\cdk.es5.js'

debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using npm@5.4.2
3 info using node@v6.10.2
4 verbose npm-session ff5ce249dfe37f0e
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall spa@0.0.0
7 info lifecycle spa@0.0.0~preinstall: spa@0.0.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 info lifecycle @angular/cdk@2.0.0-beta.10-a7ce31e~prepack: @angular/cdk@2.0.0-beta.10-a7ce31e
14 error cb() never called!
15 error This is an error with npm itself. Please report this error at:
16 error <https://github.com/npm/npm/issues>

I already tried npm cache clean --force but i get same error.

node -v v6.10.2
npm -v 5.4.2
Suneel Kumar
  • 1,650
  • 2
  • 21
  • 31
Vertigo
  • 61
  • 1
  • 1
  • 3
  • i had fixed same issue. see this link https://stackoverflow.com/questions/52467848/npm-err-cb-never-called-error-when-trying-to-run-npm-install-command/58089750#58089750 – kumar chandraketu Sep 25 '19 at 00:49

9 Answers9

10

I had the same issue. I resolved it

by excluding package-lock.json file

npm i --no-package-lock

OR by manually deleting package-lock.json

Hemadri Dasari
  • 32,666
  • 37
  • 119
  • 162
  • i had fixed same issue. see this link https://stackoverflow.com/questions/52467848/npm-err-cb-never-called-error-when-trying-to-run-npm-install-command/58089750#58089750 – kumar chandraketu Sep 25 '19 at 00:48
2

Run npm cache clean --force and perform an install.

Community
  • 1
  • 1
StangSpree
  • 421
  • 1
  • 5
  • 22
  • I found my solution in this, and with the more complete instructions of this page: https://www.alex-arriaga.com/issue-when-running-npm-install-npm-err-cb-never-called-solved/ – Arnold Schrijver Jul 24 '19 at 12:35
1

I had the same issue. I resolved it by remove nodejs@10 and install nodejs@8

1

On Windows 10 running npm install gave me this error.

I solved this issue by doing so from within Administrator: Command Prompt.

Unknow0059
  • 101
  • 3
  • 11
0

Ensure that you have a package.json file within the root of your angular project which should look something similar to this.

https://github.com/heroku/node-js-sample/blob/master/package.json

If the package.json file exists, you run npm install to get the packages saved to it and that will generate a node_modules directory for you.

However, if the file does not exist, it means you have to initialize npm into the project by running npm i -y which should automatically create a package.json file for you and as well allow you to install node modules.

NB: You have npm installed on your machine already so running npm install npm -g is not ideal.

fortunee
  • 3,852
  • 2
  • 17
  • 29
  • `package.json` exist, and this project worked a few weeks ago. But now I clone git and get this error. – Vertigo Oct 09 '17 at 12:39
  • Make sure it's in the root directory of the project where you're running `npm install` – fortunee Oct 09 '17 at 12:42
  • I running in root directory. Now I tryed install this project in other computer and `node_modules` installed whithout problem, so I think problemm in `npm`. Do you have any ideas? – Vertigo Oct 09 '17 at 12:47
  • Additionally, I added a node module to packages.json manually and removing it fixed the issue – Dean Meehan Jul 31 '18 at 09:00
  • Alright request for edit and upvote the answer. Thanks? @DeanMeehan – fortunee Jul 31 '18 at 10:51
0

I got this error when my package.json referred to a package using file:../(local path) and the directory didn't exist. Pointing it to the correct path resolved the error.

C.M.
  • 1,474
  • 13
  • 16
0

In my case... none of the above worked. I then deleted my package-lock.json. When I ran an npm install I got an error that a certain package could not be found in the repository. When I removed that from package.json my npm install worked!

Blake
  • 375
  • 2
  • 6
  • 19
0

I had the same issue. In my case it was caused by a syntax error within the .npmrc file, which was manually edited

MoxxiManagarm
  • 8,735
  • 3
  • 14
  • 43
0

Method 1: npm cache clean --force then install your package

Method 2: Disable your antivirus software and try to install your package

Method 3: It is your internet connection, if you are using Wifi or an Ethernet connection use your cellular network or a different network and try to install your package

Joosh1337
  • 153
  • 9
Jordao Manguena
  • 124
  • 2
  • 4