[BUG] All commands throw error: cb.apply is not a function
tinrab opened this issue · comments
What / Why
Using npx to run a command, for example npx webpack
, throws: "cb.apply is not a function".
Here's the output log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/tin/.nvm/versions/node/v14.5.0/bin/node',
1 verbose cli '/home/tin/.nvm/versions/node/v14.5.0/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'webpack@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli '/home/tin/.npm/_npx/42772',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v14.5.0
4 verbose npm-session 181369e9e33cec15
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/webpack 936ms
8 http fetch GET 200 https://registry.npmjs.org/webpack/-/webpack-4.43.0.tgz 278ms
9 silly pacote tag manifest for webpack@latest fetched in 1256ms
10 verbose stack TypeError: cb.apply is not a function
10 verbose stack at /home/tin/.nvm/versions/node/v14.5.0/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
10 verbose stack at FSReqCallback.oncomplete (fs.js:177:5)
11 verbose cwd /tmp
12 verbose Linux 5.4.0-40-generic
13 verbose argv "/home/tin/.nvm/versions/node/v14.5.0/bin/node" "/home/tin/.nvm/versions/node/v14.5.0/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "webpack@latest" "--global" "--prefix" "/home/tin/.npm/_npx/42772" "--loglevel" "error" "--json"
14 verbose node v14.5.0
15 verbose npm v5.1.0
16 error cb.apply is not a function
17 verbose exit [ 1, true ]
When
Tried npx webpack
and npx create-react-app
.
How
Steps to Reproduce
Having node:v14.5.0
, npm:6.14.6
and npx:10.2.2
.
Try any command.
I also have the same problem. use node: v14.6.0
and npm: 6.14.6
.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/renattonl/.nvm/versions/node/v14.6.0/bin/node',
1 verbose cli '/home/renattonl/.nvm/versions/node/v14.6.0/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-next-app@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli '/home/renattonl/.npm/_npx/16589',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v14.6.0
4 verbose npm-session 974eb6cbdcc1ae22
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/create-next-app 748ms (from cache)
8 silly pacote tag manifest for create-next-app@latest fetched in 765ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack at /home/renattonl/.nvm/versions/node/v14.6.0/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
9 verbose stack at FSReqCallback.oncomplete (fs.js:177:5)
10 verbose cwd /home/renattonl/Projects/Personals
11 verbose Linux 5.3.0-62-generic
12 verbose argv "/home/renattonl/.nvm/versions/node/v14.6.0/bin/node" "/home/renattonl/.nvm/versions/node/v14.6.0/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "create-next-app@latest" "--global" "--prefix" "/home/renattonl/.npm/_npx/16589" "--loglevel" "error" "--json"
13 verbose node v14.6.0
14 verbose npm v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]
Same exact issue using WSL Ubuntu running npx create-react-app
with node: 12.18.3
, npm: 6.14.6
and npx: 10.2.2
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/bin/node',
1 verbose cli '/usr/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'webpack@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli '/home/audeo/.npm/_npx/22750',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v12.18.3
4 verbose npm-session 86438e424bef3d61
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/webpack 258ms
8 http fetch GET 200 https://registry.npmjs.org/webpack/-/webpack-4.44.0.tgz 88ms
9 silly pacote tag manifest for webpack@latest fetched in 405ms
10 verbose stack TypeError: cb.apply is not a function
10 verbose stack at /usr/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
10 verbose stack at FSReqCallback.oncomplete (fs.js:169:5)
11 verbose cwd /mnt/c/Users/Audeo/Documents/Research/NavyProbes
12 verbose Linux 4.4.0-18362-Microsoft
13 verbose argv "/usr/bin/node" "/usr/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "webpack@latest" "--global" "--prefix" "/home/audeo/.npm/_npx/22750" "--loglevel" "error" "--json"
14 verbose node v12.18.3
15 verbose npm v5.1.0
16 error cb.apply is not a function
17 verbose exit [ 1, true ]
^^ Same exact issue using WSL Ubuntu running npx create-react-app with node: 12.18.3, npm: 6.14.6 and npx: 10.2.2
0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli '/usr/bin/node', 1 verbose cli '/usr/lib/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 '/home/brandon/.npm/_npx/14795', 1 verbose cli '--loglevel', 1 verbose cli 'error', 1 verbose cli '--json' 1 verbose cli ] 2 info using npm@5.1.0 3 info using node@v12.18.3 4 verbose npm-session eddfa2ee36b90cdb 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 http fetch GET 304 https://registry.npmjs.org/create-react-app 549ms (from cache) 8 silly pacote tag manifest for create-react-app@latest fetched in 570ms 9 verbose stack TypeError: cb.apply is not a function 9 verbose stack at /usr/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18 9 verbose stack at FSReqCallback.oncomplete (fs.js:169:5) 10 verbose cwd /home/brandon/code/shyshop 11 verbose Linux 4.15.0-1093-oem 12 verbose argv "/usr/bin/node" "/usr/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "create-react-app@latest" "--global" "--prefix" "/home/brandon/.npm/_npx/14795" "--loglevel" "error" "--json" 13 verbose node v12.18.3 14 verbose npm v5.1.0 15 error cb.apply is not a function 16 verbose exit [ 1, true ]
It appears this error happens after we're trying to update npx with npm install --force -g npx
.
This project seems to only work, when it comes bundled with npm
$ node -v
v14.7.0
$ npm -v
6.14.7
$ npx -v
6.14.7 # Note: We'll learn later it's an npm version
$ npm install --force -g npx@latest
....
+ npx@10.2.2
$ npx -v
10.2.2
$ npx anything
npm ERR! cb.apply is not a function
$ npm install -g npx@6.14.7 # Was trying to revert to v6.14.7
npm ERR! code ETARGET
npm ERR! notarget No matching version found for npx@6.14.7 # Realized it wasn't npx version that was listed
@medikoo the same here.
I experienced the same problem when trying to get going on a new svelte project in a fresh debian sid virtual installation. After some uninstalls and reinstalls in various orders, it suddenly worked as expected without this error.
What I did notice, however, was that npx could be installed to not use the "default" or "system" npm. Just running
$ npx
Will of course give info about how to run it. Under the options, there was an option to specify "--npm", and when I was experiencing this error, I was quite perplexed to see the default value being it's own, internal (and old!) version of npm set as the default.
I am honestly not able to reproduce exactly what I did, but when I now run "npx" again, the default is set to the system default npm, and that solved this problem for me.
Sorry about not being able to be of more help, but hopefully this may at least be a clue of what is going on.
iam getting this error pls help:
npx create-react-app amazon clone
npx: installed 98 in 7.159s
Creating a new React app in C:\Users\lalit\OneDrive\Desktop\amazon app\amazon.
You are using npm 4.6.1 so the project will be bootstrapped with an old unsupported version of tools.
Please update to npm 5 or higher for a better, fully supported experience.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lalit\AppData\Roaming\npm-cache_logs\2020-10-01T13_18_39_084Z-debug.log
when i try to run npm install, I am getting this error npm ERR! cb.apply is not a function, please help me to resolve this issue.
I have the same problem :(
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/tommaso/.nvm/versions/node/v14.14.0/bin/node',
1 verbose cli '/Users/tommaso/.nvm/versions/node/v14.14.0/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'install',
1 verbose cli '@angular/cli@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli '/Users/tommaso/.npm/_npx/26455',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v14.14.0
4 verbose npm-session 799baa19f88eece8
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/@angular%2fcli 196ms (from cache)
8 silly pacote tag manifest for @angular/cli@latest fetched in 237ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack at /Users/tommaso/.nvm/versions/node/v14.14.0/lib/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 /Users/tommaso/src/js/ng
11 verbose Darwin 19.6.0
12 verbose argv "/Users/tommaso/.nvm/versions/node/v14.14.0/bin/node" "/Users/tommaso/.nvm/versions/node/v14.14.0/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "@angular/cli@latest" "--global" "--prefix" "/Users/tommaso/.npm/_npx/26455" "--loglevel" "error" "--json"
13 verbose node v14.14.0
14 verbose npm v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]
I fixed the problem by forcefully updating the graceful-fs version to the latest in ~/.nvm/versions/node/vXX.XX.X/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs
(installed graceful-fs in empty project then copied the directory over)
So I suppose the npx
package is using an old version of graceful-fs with a bug stated here https://github.com/isaacs/node-graceful-fs
We should make a PR to update npx dependencies
Hello everyone, I was getting this error: npm ERR! cb.apply() is not a function, when I was trying to run npm install in Windows OS, I have fixed this issue this way: I had old projects of reactjs which had node modules, npm files and folder, so having all this I uninstalled nodejs and reinstalled nodejs, and was trying to run npm install, this was the Big mistake i did for 48 hours, so please delete All old node modules folders, npm files permanently, before installing nodejs, this is the best solution who are working on Windows OS. 😇😇
Try updating to npm 7, and make sure you don’t have the npx package separately installed.
To fix it I had to:
1.uninstall node
2. delete npm and npm_cache from %Appdata%, and all local node_modules
3. reinstall node