"cb() never called!" - very persistent, tried to solve it using conventional techniques, hasn't worked - npm

When I try to "npm install" my project, it always results in a "cb() never called!". I'm using the 6.14.13 version of npm and 14.17.0 version of node.
I've tried running this command on a different machine- works there. I've also tried...
Running "npm cache clean --force" "npm cache verify"
Deleting node_modules folder
Completely uninstalling and reinstalling node
Combining steps 1-3
It resolved itself for about 12 hours one time, even though I hadn't changed anything. (I ran it once, it failed, ran it again about 60 seconds later, and it worked). I also tried cloning the repository into another folder. This hadn't worked previously, but as of this morning, it does now for some reason.
I'm very confused. Please help. Thank you.

It seems that this may be due to your package-lock.json being corrupted.
Have you tried:
deleting package-lock.json
then running: npm cache clean --force
then running: npm install
source: https://reactgo.com/npm-err-cb-never-called/
This old SO post has some more ideas you could try: npm ERR cb() never called

Related

NPM stuck on idealTree: timing idealTree

Today i decided to start react native cli project. Everything works great since i want to add new lib of course using npm . So i ran npm install ... . And this command always stuck on
Image
idealTree: timing idealTree Completed in 3440ms
And nothing happened. So i tried to ran
npm install --verbose
And again stuck on the same place. Also clear cache npm cache clear --force and nothing happened again. I don'n know how to fix this
I have had npm install freeze on me numerous times, lately. I'm not sure of the cause. When that happens I follow these steps:
Kill the npm install process with ctrl+c.
Delete node_modules. If there are files that you cannot delete because they are currently in use, that may mean that the npm install process was not successfully stopped. Try opening Task Manager and ending all nodejs and terminal processes. If this fails, restart your pc and then delete node_modules
Clean cache and reinstall node_modules with npm cache clean --force && npm i
This has happened to me a few times before and all I had to do was kill my dev server before running npm install.
Hope that helps as well!
I had the same issue on node latest version v18.8.0 and npm v8.18.0, I just downgraded to node 16.6 using nvm and it worked fine.
For me, the issue was that I had node running for a separate project. Terminating the other node process fixed the issue.
When i opened my package.json i saw '~2.2.1' in front of react-native-gesture-handler which probably means that it was notinstalled properly
Just close all terminals and then open task manager and kill all the processes corresponding to NodeJS. Then install it again.
Hopefully it will resolve.
I also faced this problem and the solution was simple by stopping all the "nodejs terminals" that are working outside.
When you stop nodeJS Terminals running in the background, it will complete the current installation process.
enter image description here
When you want to add package on your project it is better to stop server before adding new package.
I had same problem but after doing this it is solved.

Undefined packages added after "npm update -g"

I accidentally installed "react" and "react-dom" as global packages, and promptly uninstalled them.
But now everytime I run npm update -g, two undefined packages "+ undefined#0.1.0 (as react-dom)" and "+ undefined#0.1.0 (as react)" are added. npm list -g --depth 0 lists them as "+-- react#npm:undefined#0.1.0" and "+-- react-dom#npm:undefined#0.1.0".
They are not breaking anything, and I can always just uninstall them after they pop up each time, but it's become a minor annoyance.
I tried "npm cache clean --force" but the problem persists.
Please help me find a way to get rid of these undefined packages forever, thank you for your time!
Problem solved after I manually deleted the folders of the undefined projects from the root of my npm installation, on the advice of #ambianBeing.
Note: you can locate the root of your npm installation with npm -g root.

Npm install makes Windows crash

Generally when I run npm install sometimes my pc crashes and shows the screen like the image below. I’ve tried removing both the package-lock.json and node_modules. I’ve also run the commands npm rebuild -g and npm cache clean -f.
2 days ago I reinstalled my pc to fabric settings and it still doesn’t help.
I’m using WSL, nodejs v12.10.0 and npm 6.10.3.
Anyone knows what’s up and could help me?
https://imgur.com/a/762AdrR
Update
I've been using yarn instead of npm since 3 months back and this problem has never occured again. So if you are experiencing the same problem as me, try it out.

How does npm error affect old git commits?

In my create-react-app project I've installed many node packages via npm. Every time, I've used npm install --save to update package.json and package-lock.json and then committed the changes to git.
Recently, something caused a previously-working npm module to fail. Since I couldn't find the cause, I tried removed and reinstalled all dependencies like this:
rm -rf node_modules/
npm install
However, the same module still fails, even when I switch back to older commits and repeat the commands above!
Since the problem can't be in the committed code itself (which is running fine on another machine), the problem must be somewhere else such as in the create-react-app development server or the /node_modules.
How can I reset my work to a working state, given that everything is in git and was working before?
UPDATE:
My answer below turned out to be only partly right. npm did install a newer version of the package, but that was not actually the problem after all. The true fix was realising that my data (from my database) was corrupt, so returning to prior "working version" made no difference until I fixed my data!
UPDATE: As mentioned in the updated question, this answer did not actually solve my problem after all. Messing around with the npm modules did fix something, but it soon started failing again, so the fix was incomplete.
UPDATE 2: There was also a problem in the data I was passing from my database to the module! That data is not stored in git, so fiddling with npm modules and git had no power.
It seems that the problem was in the npm versioning! Since my package.json listed somepackage#^6.0.0, running npm install fetched the latest version (which had the bug).
Hence, my old working commits that referenced somepackage#^6.0.0 still actually installed the new faulty version when re-installed from scratch.
The solution was to edit package.json and change somepackage#^6.0.0 to somepackage#6.0.0(exact match without ^)

yarn no longer present

Been running my npm start, which uses yarn, over and over for the last 5 months and has been working since day dot. I even see it in my Terminal history 10 lines above.
> yarn
yarn install v1.10.1
I killed my npm start process a moment ago, and now for some reason, I get this...
> yarn
sh: yarn: command not found
Yarn is no longer installed on my system...for some reason. So I installed it and get the usual information that it's installed.
$ npm -g install yarn
+ yarn#1.12.3
added 1 package in 2.786s
But yarn still isn't installed and I'm still getting the same above issue.
I haven't done anything that would have messed up yarn in anyway (no installing/updating/removing of any packages), so I'm completely stumped as to what the heck happened.
Has anyone had this issue, know what it is and has a fix?
After a bit of playing around, it seems that killing yarn in the process of it doing it's update, killed it's global link (e.g. /usr/bin/yarn) to it's binary.
So I ran the yarn application from it's full path, which I got from the npm install -g yarn (in my case /usr/local/Cellar/node/10.12.0/bin/yarn).
This then updated yarn, reinstalling the links and fixing it, and now it's all working. :)