如何修复cb.apply is not a function
?
$ node -v
v16.16.0
$ npm -v
8.11.0
$ npx -v
10.2.2
$ npx nuxi init nuxt-app
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /home/me/.npm/_logs/2022-07-19T11_46_43_598Z-debug.log
L'installation de [ 'nuxi@latest' ] a échoué avec le code 1
$ cat /home/me/.npm/_logs/2022-07-19T11_46_43_598Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/bin/node',
1 verbose cli '/usr/local/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'nuxi@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli '/home/me/.npm/_npx/7138',
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 bdbc314b7bc264a3
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/nuxi 174ms
8 http fetch GET 200 https://registry.npmjs.org/nuxi/-/nuxi-3.0.0-rc.6.tgz 197ms
9 silly pacote tag manifest for nuxi@latest fetched in 395ms
10 verbose stack TypeError: cb.apply is not a function
10 verbose stack at /usr/local/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
10 verbose stack at FSReqCallback.oncomplete (node:fs:199:5)
11 verbose cwd /home/me/code
12 verbose Linux 5.15.0-41-generic
13 verbose argv "/usr/bin/node" "/usr/local/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "nuxi@latest" "--global" "--prefix" "/home/me/.npm/_npx/7138" "--loglevel" "error" "--json"
14 verbose node v16.16.0
15 verbose npm v5.1.0
16 error cb.apply is not a function
17 verbose exit [ 1, true ]
2条答案
按热度按时间olmpazwi1#
最后我用
nvm
解决了这个问题。所以,我删除了nodejs:
并安装了
nvm
,nodejs
,npm
和我的Nuxt3项目,ghhaqwfi2#
此
cb.apply is not a function
错误是由graceful-fs
软件包与npm
版本5.x之间的不兼容间接导致的。在顶部,我可以看到您的
npm
版本是8.11.0 -这是好的。然而,大约完成一半时,详细日志显示您拥有一个“有效的”npm版本5.1.0
很明显,您有旧的、剩余的工件,并且不经意地选择了不正确的版本。
建议清理节点,清除,清除缓存,安装最新版本。
好运