Here we will learn how to fix "npm ERR cb() never called" error in our nodejs application easily. This error is very common in any JavaScript frameworks and libraries like reactjs, vuejs too.
This error usually occurs
To fix the npm err cd() error, i found this four solutions and it fixes my issue.
If the error occurs in local machine then clearing the cache fix the error.
So, first delete the package-lock.json
file and then run the following command
npm cache clean --force
and run npm install
again to update the package-lock.json file
If you are running on a npm version which is lower than what is required by the package you will get the error.
To upgrade your node version globally , run:
npm install npm@latest -g
Delete package-lock.json
file and whole node_modules
folder and then reinstall everything by running the command:
npm install
Note: Do not delete the package.json file or
npm install
wont work.
Sometimes when deploying our application on some online platform like heroku etc, we might get this error. It's because they need a specific node version to work properly.
To fix we just need to specify the specific version in the package.json
file.
"engines": {
"node": "12.x.x"
}
Once you have update your package.json file with correct version, you can deploy it.
I hope the above two solution works for you too. 😀
Related Topics: