[BUG] cb.apply is not a function
mssngr opened this issue · comments
What / Why
NPX fails with cb.apply is not a function
error every single time I try to use npx
.
When
- Anytime I try to use NPX
- First noticed after I successfully ran
npx create-react-app <project-name> --typescript
- All
npx
commands afterward failed
Where
- All npm packages
How
Current Behavior
~ npx hello-world-npm
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/p2813835/.npm/_logs/2021-01-14T22_24_12_119Z-debug.log
Install for [ 'hello-world-npm@latest' ] failed with code 1
Reinstalling npx
does not solve
Steps to Reproduce
- Unsure. Maybe try to use
npx
to create a react app with the typescript template? - Then try to use
npx
after that?
Expected Behavior
npx
should work
Also, reinstalling with npm globally gives this error?
~ npm install -g npx
/usr/local/bin/npx -> /usr/local/lib/node_modules/npx/index.js
npm ERR! Darwin 19.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "npx"
npm ERR! node v14.15.4
npm ERR! npm v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package graphql@14.2.1 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer graphql-config@2.2.1 wants graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0
npm ERR! peerinvalid Peer apollo-codegen-core@0.20.1 wants graphql@^0.11.0 || ^0.12.0 || ^0.13.0
npm ERR! peerinvalid Peer graphql-static-binding@0.9.3 wants graphql@^0.11.0 || ^0.12.0 || ^0.13.0
npm ERR! peerinvalid Peer graphql-import@0.7.1 wants graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0
npm ERR! peerinvalid Peer @kbrandwijk/swagger-to-graphql@2.4.3 wants graphql@^0.12.0 || ^0.13.0
npm ERR! Please include the following file with any support request:
npm ERR! /Users/p2813835/npm-debug.log
Those errors are in your npm ls -g
, and have nothing to do with npx.
Ok. You can ignore that, then.
As for the cb.apply is not a function
error, I found a workaround:
~ npx --npm /usr/local/bin/npm hello-world-npm
npx: installed 1 in 2.554s
Hello World NPM
It seems the npm
supplied by npx
has issues. Using my system's npm
resolves the issues. Why does npx
supply its own npm
?
Looks like this would solve it: #70
Issue is that the old version of npm
that npx
has in its /bin
folder is not compatible with the lts
version of node
. Downgrading my node to node@10.23.1
resolves this issue.
~ node --version
v10.23.1 /0.1s
~ npx hello-world-npm
npx: installed 1 in 1.801s
Hello World NPM /2.0s
This is such a simple issue. Hope that PR gets merged soon (been open for 6 months.)
I downgraded npm to npm@6.14.11 and all is working again.