๐ [BUG] "npm ERR! cb() never called!" or "Exit handler never called"
Problem
\Updated\ as of 01/15/2021 Note: Please read this doc-never-called%3F-Exit-handler-never-called%3F-I'm-having-the-same-problem!%22) before filing a new issue.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix npm 'cb() never called!' Error
The 'cb() never called!' error typically occurs due to issues with npm's cache, corrupted package installations, or conflicts between package versions. This can happen when npm is interrupted during installation or when there are network issues while fetching packages.
Awaiting Verification
Be the first to verify this fix
- 1
Clear npm cache
Clearing the npm cache can resolve issues caused by corrupted cache files. This step ensures that npm fetches fresh copies of packages.
bashnpm cache clean --force - 2
Update npm to the latest version
Using an outdated version of npm can lead to bugs that have been resolved in newer releases. Updating npm ensures you have the latest fixes and features.
bashnpm install -g npm@latest - 3
Remove node_modules and package-lock.json
Deleting the node_modules folder and package-lock.json file ensures that all packages are reinstalled fresh, which can resolve version conflicts and corrupted installations.
bashrm -rf node_modules package-lock.json - 4
Reinstall project dependencies
After clearing the cache and removing existing packages, reinstalling dependencies will fetch the latest compatible versions as specified in package.json.
bashnpm install - 5
Check for global package conflicts
Sometimes global packages can conflict with local project dependencies. Check for globally installed packages that may interfere with your project and consider uninstalling them if necessary.
bashnpm list -g --depth=0
Validation
To confirm the fix worked, run your npm commands again and ensure that the error does not reappear. Additionally, verify that all dependencies are installed correctly by checking the node_modules folder and running your application.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep