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

On a Mac I had to do:

rm -r ~/.node_modules_global/
sudo npm cache clean --force
sudo rm -r /usr/local/bin/npm
sudo rm -rf /usr/local/lib/node_modules  
brew uninstall node
brew install node

npm version was 4.1.2 node version was 15.0.1

piskernik avatar Oct 24 '20 18:10 piskernik

For me it was (Arch up-to-date):

rm -rf .node_modules_global
npm cache clean --force

szebenyib avatar Nov 04 '20 10:11 szebenyib

@tanjilk - npm will not remove data by itself: the cache will grow as new packages are installed. hence npm clean cache —force delete all data out of the cache folder. if it doesn't work then you can manually delete the folder %appdata%\npm-cache and then install the npm install npm@latest -g hope it may help I deleted the npm-cache folder in %appdata% but if i run npm install npm@latest -g appears that.

C:\Users\Aluno\AppData\Roaming>npm install npm@latest -g
npm WARN npm npm does not support Node.js v12.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10
, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN npm npm does not support Node.js v12.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10
, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Aluno\AppData\Roaming\npm-cache\_logs\2020-11-09T09_03_49_
523Z-debug.log```   

tskxz avatar Nov 09 '20 09:11 tskxz

I am trying to install the request module with npm and appears that

npm WARN npm npm does not support Node.js v12.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10
, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN npm npm does not support Node.js v12.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10
, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Aluno\AppData\Roaming\npm-cache\_logs\2020-11-09T09_06_38_
065Z-debug.log```

tskxz avatar Nov 09 '20 09:11 tskxz

@tanjilk - can you try installing latest version of node.

PoojaDurgad avatar Nov 09 '20 09:11 PoojaDurgad

still an issue

node version 14.2.0 npm 6.14.8

cleaned cache with --force

npm ERR! node v14.12.0
npm ERR! npm  v3.10.10

npm ERR! cb.apply is not a function

no remedy

MEANSTACKDIGITAL avatar Nov 13 '20 22:11 MEANSTACKDIGITAL

so Im just tryign to get my 50k lines of production code running on angular v11

UPDATE... (had to sneak back down to node v10 to get this past the callback cb.apply SPOOF)

ok so I had to uninstall node.js v15
install node.js verion v10
then do a massive upgrade/install of all my package.json packages as originally attempted
it completed fine no cb.apply err
then I uninstalled node 10
then I installed node v15

kind of a yuck but it worked something internally is binding to an earlier version of npm npm ERR! node v14.12.0 npm ERR! npm v3.10.10 tripping up my big angular 11 upgrade

my angular code installed and built beautifully without a hitch upgraded to angular v11

MEANSTACKDIGITAL avatar Nov 14 '20 08:11 MEANSTACKDIGITAL

I was at node v12.18.4 when having such issues. Fixed by upgrading node to v12.20.0.

nikopolidi avatar Nov 29 '20 07:11 nikopolidi

I started having this issue when trying to create a react app. I have tried both options 1 and 2 as provided by allaura-dev, but none of them worked for me.

I am still having issues on the current node.js version node: 15.3.0 npm: 7.0.15

Here is my log:

1 warn npm npm does not support Node.js v15.3.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can't make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [
6 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
6 verbose cli   'C:\\Users\\infinity\\Documents\\Code\\node_modules\\npm\\bin\\npm-cli.js',
6 verbose cli   'install',
6 verbose cli   '--save',
6 verbose cli   '--save-exact',
6 verbose cli   '--loglevel',
6 verbose cli   'error',
6 verbose cli   'react',
6 verbose cli   'react-dom',
6 verbose cli   'react-scripts',
6 verbose cli   'cra-template'
6 verbose cli ]
7 info using [email protected]
8 info using [email protected]
9 verbose npm-session aeddb80927b099fa
10 silly install loadCurrentTree
11 silly install readLocalPackageData
12 verbose stack TypeError: cb.apply is not a function
12 verbose stack     at C:\Users\infinity\Documents\Code\node_modules\npm\node_modules\graceful-fs\polyfills.js:285:20
12 verbose stack     at FSReqCallback.oncomplete (node:fs:193:5)
13 verbose cwd C:\Users\infinity\Documents\Code\React\my-react-app
14 verbose Windows_NT 10.0.19041
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\infinity\\Documents\\Code\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template"
16 verbose node v15.3.0
17 verbose npm  v6.6.0
18 error cb.apply is not a function
19 verbose exit [ 1, true ]

EDIT: I tried also on 14.15.1 LTS and having the same problem running npx create-react-app

Solved: https://github.com/facebook/create-react-app/discussions/10173#discussioncomment-142156

Infinitay avatar Nov 30 '20 03:11 Infinitay

For Ubantu, I have tried a lot of solutions from different posts and google pages and nothing worked for me.

I ended up cleaning all traces of node, nodejs, and npm. May need some manual force remove after the purge call. And then installed using nvm.

https://linuxize.com/post/how-to-install-node-js-on-ubuntu-20-04/#installing-nodejs-and-npm-using-nvm

And it resolved the issue for me. It got the nodejs v 15.4.0 and the compatible version of npm 7.0.15 ( before using apt-get it was installing npm 6.9.0)

RajibulAlam avatar Dec 20 '20 05:12 RajibulAlam

first option worked. thankyou!

fatimashahid101 avatar Dec 23 '20 06:12 fatimashahid101

I am using 10.12.0 use nvm fixed it nvm uninstall 10.12.0 nvm install 10.12.0

sage-ihealth avatar Dec 24 '20 08:12 sage-ihealth

This works for me from: https://github.com/jprichardson/node-fs-extra/issues/703 Im just download zip https://github.com/isaacs/node-graceful-fs to /usr/local/lib/node_modules/ and extract with name graceful-fs

gnazaryan avatar Dec 31 '20 16:12 gnazaryan

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.

Both the options didnot work for me. Downgrading the node version to v12.6.0 fixed the issue.

kryalama avatar Jan 06 '21 02:01 kryalama

Why is this bug still occurring? Do all developers have to resort to manual workarounds and edit their filesystem directly?

I just installed the latest version of NodeJS on Windows and getting this error, presumably because something is wrong with my npm cache, from a previous version. I guess I'll have to manually delete it like others here (470mb worth). But would be nice to get a proper fix.

SimonEast avatar Jan 11 '21 02:01 SimonEast

Option 1 worked perfectly! manually deleting the npm from an old version seemed to do the trick 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)

ck1ldn avatar Jan 19 '21 13:01 ck1ldn

node v-15.8.0 cb.apply is not a function

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:\Program Files\nodejs\node_modules\npx\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'install', 1 verbose cli 'create-react-app@latest', 1 verbose cli '--global', 1 verbose cli '--prefix', 1 verbose cli 'C:\Users\Billy\AppData\Roaming\npm-cache\_npx\8048', 1 verbose cli '--loglevel', 1 verbose cli 'error', 1 verbose cli '--json' 1 verbose cli ] 2 info using [email protected] 3 info using [email protected] 4 verbose npm-session c3d3d5dc7393cfd5 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 http fetch GET 304 https://registry.npmjs.org/create-react-app 186ms (from cache) 8 silly pacote tag manifest for create-react-app@latest fetched in 222ms 9 verbose stack TypeError: cb.apply is not a function 9 verbose stack at C:\Program Files\nodejs\node_modules\npx\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18 9 verbose stack at FSReqCallback.oncomplete (node:fs:197:5) 10 verbose cwd C:\www\Billy\Planos 11 verbose Windows_NT 10.0.19042 12 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npx\node_modules\npm\bin\npm-cli.js" "install" "create-react-app@latest" "--global" "--prefix" "C:\Users\Billy\AppData\Roaming\npm-cache\_npx\8048" "--loglevel" "error" "--json" 13 verbose node v15.8.0 14 verbose npm v5.1.0 15 error cb.apply is not a function 16 verbose exit [ 1, true ]

billyrtc13 avatar Feb 04 '21 17:02 billyrtc13

Same for me... a soon as you are using nvm after switching the version npx does not work anymore.

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\\info\\AppData\\Roaming\\npm\\node_modules\\npx\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '@backstage/create-app@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   'C:\\Users\\info\\AppData\\Roaming\\npm-cache\\_npx\\32888',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 760bafac7cb2c2a7
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/@backstage%2fcreate-app 425ms (from cache)
8 silly pacote tag manifest for @backstage/create-app@latest fetched in 476ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack     at C:\Users\info\AppData\Roaming\npm\node_modules\npx\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
9 verbose stack     at FSReqCallback.oncomplete (fs.js:184:5)
10 verbose cwd C:\Users\info\Projects\tests\backstage
11 verbose Windows_NT 10.0.19041
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\info\\AppData\\Roaming\\npm\\node_modules\\npx\\node_modules\\npm\\bin\\npm-cli.js" "install" "@backstage/create-app@latest" "--global" "--prefix" "C:\\Users\\info\\AppData\\Roaming\\npm-cache\\_npx\\32888" "--loglevel" "error" "--json"
13 verbose node v14.15.4
14 verbose npm  v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]

super-kamil avatar Feb 05 '21 11:02 super-kamil

for UBUNTU and MAC:

go to the outside folder of your volumes, not the root folder, don't install create-react-app global. run this : npm install create-react-app , it will make a node_modules folder. and then you can run npx create-react-app my-app

ndhanh96 avatar Mar 06 '21 06:03 ndhanh96

i don't have this appdata folder

ShubhamPatel0736 avatar Mar 09 '21 07:03 ShubhamPatel0736