You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 npm@4.6.1
3 info using node@v12.18.3
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 ]
Yeah having the same issue with node 12.18.3 & 14.6.0
Reacted by Allaura Hanley, Debjeet Biswas, shreya-1306, 张雷, richachhabra, limsingsparksoft, Ritu Thadhani, ziqguo, mkenirons, Daniel Smolinski and 20 more
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.
Reacted by Hanno Georg, Matt Kehrls, blackthought286, Travis Redington, Craig Campbell, Josh de Leeuw, Annie Zhang, Sergey Sharov, Carey Estes, Satej Bidvai and 291 more
Reacted by Sezgi Şensöz, Paul Melero, Kurt Fiorentino, Ahmmad Al Qaisi, Brad Wray, Lee Wang Jong, Aaron Meese, Nokkia, extjahn and lynn
Reacted by Wa il H, André Ferreira, Malina228, One, Valentin Porchet, akita, Richard Deslauriers, marcuzgabriel, Annisa Purbandari, raphael bridi and 7 more
Reacted by teknorix1, Askar R, millett, emmtqg, kartik nuli, SrikanthCM, Kishan Patel, halzahrani83, richachhabra, Gabriel Perez and 29 more
Reacted by halzahrani83, Ridam Loomba, Gabriel Perez, philippe MEYER, sumayi, Jeong Hyunseok , Ivan Sarokin, Alexandre Duvois, sasha-o6, Andrija Cvejić and 41 more
Reacted by kartik nuli, SrikanthCM, Kishan Patel, halzahrani83, philippe MEYER, Jeong Hyunseok , Christopher Christensen, Ivan Sarokin, Alexandre Duvois, André Ferreira and 22 more
I found resolve in downgrading to Node 12.18.2 as the graceful-fs that was being used was hard linked by an older dependency of mine. For the lazy (Linux):
Reacted by Allaura Hanley, Felipe Augusto Rosa, Jonathan Argentiero, Natan Cardoso, Xavier Bergeron, George Hahn, Ahmed Hosny, Devrim Şahin, mkenirons, svenakela and 23 more
Reacted by darrenzou2000
Reacted by Abdurrahman Ekinci, John, Mircea-Stefan Mohora, LeonKowalski, Matronator, Descartes Fowo, Mark Mackend and Dmitry
Reacted by svenakela, Abdurrahman Ekinci, Mircea-Stefan Mohora, Yousseff Muhammed EL Masry, Mark Mackend and Dmitry
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 mom 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.
Can the solution provided by @allaura-dev added to nodejs installer in case of major version upgrade?
I updated nodejs today and ran into the same issue just to find out someone already found a solution... :-(
I noticed that since I am using NVM, everything points to /Users/{username}/.nvm/...etc when checking for node, npm and npx versions. However, when executing npx create-react-app command, the error points to /Users/{username}/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
It's using the correct node version through NVM but it's reverting to using the wrong node_modules folder as if it's the default. I deleted the node_modules folder and it all worked perfect.
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.
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.
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.
It seems that you can use npm root -g to find the directory which is not AppData\Roaming on 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.
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:
It seems that you can use npm root -g to find the directory which is not AppData\Roaming on 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.
Activity
travisredington commentedon Jul 24, 2020
Yeah having the same issue with node 12.18.3 & 14.6.0
allaura-dev commentedon Jul 24, 2020
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.
travisredington commentedon Jul 24, 2020
great, will try sometime soon, thanks!
MattKehrls commentedon Jul 25, 2020
First Option worked great for me, thanks! (v.12.18.3)
blackthought286 commentedon Jul 25, 2020
worked. Thanks
travisredington commentedon Jul 25, 2020
Yeah, option 1 worked for me as well! Thanks! ( using v14.6.0 )
aldanin commentedon Jul 25, 2020
First option worked for me.
Thanks a bunch!
sdtime-io commentedon Jul 27, 2020
mac how to do?
Ivo-Balbaert commentedon Jul 27, 2020
Thank you very much!!
AHassanSOS commentedon Jul 28, 2020
This error is new. It happens if I try to install npm twice in the row.
kulor commentedon Jul 29, 2020
I found resolve in downgrading to Node 12.18.2 as the
graceful-fsthat was being used was hard linked by an older dependency of mine. For the lazy (Linux):ridhi-mago commentedon Jul 31, 2020
First option worked!! Thanks!
HarelM commentedon Aug 1, 2020
Can the solution provided by @allaura-dev added to nodejs installer in case of major version upgrade?
I updated nodejs today and ran into the same issue just to find out someone already found a solution... :-(
yasarui commentedon Aug 2, 2020
First option worked for me. Thanks a lot
86 remaining items
RyanLiu0235 commentedon Dec 10, 2021
Listen to me, download and install the newest LTS version NodeJS, and the world turns out just fine.
mycob commentedon Feb 21, 2022
This worked for me and I hope it's helpful...
Tried everything suggested but none worked.
I noticed that since I am using NVM, everything points to /Users/{username}/.nvm/...etc when checking for node, npm and npx versions. However, when executing npx create-react-app command, the error points to /Users/{username}/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
It's using the correct node version through NVM but it's reverting to using the wrong node_modules folder as if it's the default. I deleted the node_modules folder and it all worked perfect.
yangqiang1 commentedon Mar 13, 2022
我试过了所有方法还是不行
yangqiang1 commentedon Mar 13, 2022
finally,I did it by nvm using old version eg 14.18.2, it is unuseful by using node(the latest version).
Fahad16301139 commentedon Apr 2, 2022
thanks!first option worked for me!!
fernenfern commentedon Nov 18, 2022
Thanks ! Worked for me .Thank u very much
bobcorp99 commentedon Dec 1, 2022
I had the same problem, tried it out, and It works, THANK YOU!
arashi-dev commentedon May 20, 2023
Another Solution
I don't know how it worked but I deleted folder
C:\Users\[username]\AppData\Local\Yarnand repaired the nodejs through the exe file and it got fixed. now I can use the latest version of npm.erg commentedon Jun 7, 2023
for macos:
which npx/Users/erg/.nvm/versions/node/v18.2.0/bin/npx
nuke it all:
rm -rf ~/.nvm/versionsshgit-dev commentedon Sep 1, 2023
Thanks @allaura-dev First Option works for me.
1akshat commentedon Oct 10, 2023
Worked for me! Thanks 🙏 🎉
simon-os commentedon Dec 28, 2023
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
wuqingabc commentedon May 19, 2024
Save my day, thank you.
plasticalligator commentedon May 20, 2024