error cb.apply is not a function
- Node.js Version: { npm: '4.6.1', ares: '1.16.0', brotli: '1.0.7', cldr: '37.0', icu: '67.1', llhttp: '2.0.4', modules: '83', napi: '6', nghttp2: '1.41.0', node: '14.6.0', openssl: '1.1.1g', tz: '2020a', unicode: '13.0', uv: '1.38.1', v8: '8.4.371.19-node.12', zlib: '1.2.11' }
- OS: Windows 10
- Scope (install, code, runtime, meta, other?): runtime
I can not do anything with my npm as I keep receiving "error cb.apply is not a function"
- I have tried to clear the cache but it can not due to this error
- I removed everything to do with does and the tools it downloads with it and reinstalled with windows up to date then rebooted but still receive the same error -i have tried npm doctor but failed due to this error
- I have checked the path is correct for nodejs and node_modules How can i fix this issue?
Error chache information
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:\Users\allie\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'install' 1 verbose cli ] 2 info using [email protected] 3 info using [email protected] 4 verbose config Skipping project config: C:\Users\allie/.npmrc. (matches userconfig) 5 silly install loadCurrentTree 6 silly install readLocalPackageData 7 verbose stack TypeError: cb.apply is not a function 7 verbose stack at C:\Users\allie\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18 7 verbose stack at FSReqCallback.oncomplete (fs.js:169:5) 8 verbose cwd C:\Users\allie 9 verbose Windows_NT 10.0.19041 10 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\allie\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" 11 verbose node v12.18.3 12 verbose npm v4.6.1 13 error cb.apply is not a function 14 verbose exit [ 1, true ]
我试过了所有方法还是不行
我试过了所有方法还是不行
finally,I did it by nvm using old version eg 14.18.2, it is unuseful by using node(the latest version).
thanks!first option worked for me!!
I solved it on both my computers. One needed more work on it. Option 1: Follow this directory C:\Users(your username)\AppData\Roaming Delete the npm folder and if there is one npm cache folder. Run npm clean cache —force ( — force is now required to clean cache) You should be good now if not do option 2.
Option 2: Follow this directory C:\Users(your username)\AppData\Roaming Delete the npm folder and if there is one mom cache folder. Run npm clean cache —force ( — force is now required to clean cache) Make sure everything to do with Nodejs is deleted and uninstalled. Reinstall Nodejs. You should be good now.
Thanks ! Worked for me .Thank u very much
I had the same problem, tried it out, and It works, THANK YOU!
Another Solution
I don't know how it worked but I deleted folder C:\Users\[username]\AppData\Local\Yarn and repaired the nodejs through the exe file and it got fixed. now I can use the latest version of npm.
for macos:
which npx
/Users/erg/.nvm/versions/node/v18.2.0/bin/npx
nuke it all:
rm -rf ~/.nvm/versions
I solved it on both my computers. One needed more work on it. Option 1: Follow this directory C:\Users(your username)\AppData\Roaming Delete the npm folder and if there is one npm cache folder. Run npm clean cache —force ( — force is now required to clean cache) You should be good now if not do option 2.
Option 2: Follow this directory C:\Users(your username)\AppData\Roaming Delete the npm folder and if there is one mom cache folder. Run npm clean cache —force ( — force is now required to clean cache) Make sure everything to do with Nodejs is deleted and uninstalled. Reinstall Nodejs. You should be good now.
Thanks @allaura-dev First Option works for me.
mac how to do?
It seems that you can use
npm root -gto find the directory which is notAppData\Roamingon a mac. Though in my case it turned out I had an old~/node_modules/lying around causing problems. When I deleted it this problem went away.
Worked for me! Thanks 🙏 🎉
Unfortunately, none of the solutions listed above worked for me. I found out that in my case the problem was in system PATH variable. I have two profiles on windows, so I had two entries in the PATH variable pointing to the same place. It looked like this:
C:\Users{USER_1}\AppData\Roaming\npm C:\Users{USER_2}\AppData\Roaming\npm
Once I removed one of the path entries, it worked! To be precise, I removed the one that pointed to the directory of user, that wasn't for work
mac how to do?
It seems that you can use
npm root -gto find the directory which is notAppData\Roamingon a mac. Though in my case it turned out I had an old~/node_modules/lying around causing problems. When I deleted it this problem went away.
Save my day, thank you.
Whoever closed this issue without actually fixing the problem deserves to have their legs broken. That is all. You disgust me.