help icon indicating copy to clipboard operation
help copied to clipboard

error cb.apply is not a function

Open allaura-dev opened this issue 6 years ago • 112 comments

  • 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 ]

allaura-dev avatar Jul 23 '20 15:07 allaura-dev

Yeah having the same issue with node 12.18.3 & 14.6.0

travisredington avatar Jul 24 '20 17:07 travisredington

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.

allaura-dev avatar Jul 24 '20 17:07 allaura-dev

great, will try sometime soon, thanks!

travisredington avatar Jul 24 '20 20:07 travisredington

First Option worked great for me, thanks! (v.12.18.3)

MattKehrls avatar Jul 25 '20 03:07 MattKehrls

worked. Thanks

blackthought286 avatar Jul 25 '20 14:07 blackthought286

Yeah, option 1 worked for me as well! Thanks! ( using v14.6.0 )

travisredington avatar Jul 25 '20 14:07 travisredington

First option worked for me. Thanks a bunch!

aldanin avatar Jul 25 '20 16:07 aldanin

mac how to do?

sdtime-io avatar Jul 27 '20 08:07 sdtime-io

Thank you very much!!

Ivo-Balbaert avatar Jul 27 '20 11:07 Ivo-Balbaert

This error is new. It happens if I try to install npm twice in the row.

AHassanSOS avatar Jul 28 '20 19:07 AHassanSOS

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):

NODE_VERSION=12.18.2
curl -sSL "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" | sudo tar --strip-components=2 -xJ -C /usr/local/bin/ node-v$NODE_VERSION-linux-x64/bin/node

kulor avatar Jul 29 '20 15:07 kulor

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.

First option worked!! Thanks!

ridhi-mago avatar Jul 31 '20 12:07 ridhi-mago

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... :-(

HarelM avatar Aug 01 '20 19:08 HarelM

First option worked for me. Thanks a lot

yasarui avatar Aug 02 '20 14:08 yasarui

First option worked. Thanks a lot

lumosmind avatar Aug 02 '20 20:08 lumosmind

Guys if you are trying to follow the answer above and you cannot access the 'C:\Users(your username)\AppData\Roaming' folder, then go to 'this PC' in file explorer, search 'npm', you will see folders 'npm' or 'npm-cache' which are inside '...AppData\Roaming' folders. Delete these by accessing the path to '...\AppData\Roaming'.

Naz786 avatar Aug 06 '20 21:08 Naz786

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 agree. I was working on a new project and the same thing happened.

allaura-dev avatar Aug 06 '20 21:08 allaura-dev

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.

You saved me, Thanks

teknorix1 avatar Aug 07 '20 11:08 teknorix1

mac how to do?

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.

gigamonkey avatar Aug 09 '20 02:08 gigamonkey

For me, it worked when I reinstalled graceful-fs by running npm install graceful-fs --save-dev as suggested by Giovanni Esposito here: https://stackoverflow.com/questions/63054545/all-my-react-native-projects-shows-error-typeerror-cb-apply-is-not-a-function/63054816#63054816

blackraspberryyy avatar Aug 14 '20 02:08 blackraspberryyy