美文网首页
MAC 上处理error cb.apply is not a f

MAC 上处理error cb.apply is not a f

作者: 开发狗 | 来源:发表于2021-07-01 15:16 被阅读0次

我是在使用npx mrm lint-staged时遇到报这个错误。以下是输出的log日志。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/opt/homebrew/Cellar/node/16.3.0/bin/node',
1 verbose cli   '/opt/homebrew/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'mrm@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   '/Users/york/.npm/_npx/49959',
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@v16.3.0
4 verbose npm-session fc4e5fd1a63aa463
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npm.taobao.org/mrm 155ms (from cache)
8 silly pacote tag manifest for mrm@latest fetched in 171ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack     at /opt/homebrew/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
9 verbose stack     at FSReqCallback.oncomplete (node:fs:196:5)
10 verbose cwd /Users/york/Desktop/ReactProgram/jira
11 verbose Darwin 20.5.0
12 verbose argv "/opt/homebrew/Cellar/node/16.3.0/bin/node" "/opt/homebrew/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "mrm@latest" "--global" "--prefix" "/Users/york/.npm/_npx/49959" "--loglevel" "error" "--json"
13 verbose node v16.3.0
14 verbose npm  v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]

不知道是因为什么原因导致的报错。这里只记录下帮我解决了的一种办法。

  • Mac通过前往(GO)找到/opt/homebrew/lib/node_modules/npx/node_modules/npm这个目录下的npm文件夹并删除
  • 运行 brew install npm,重新装载npm
    安装过程中根据指引就可以了。

相关文章

网友评论

      本文标题:MAC 上处理error cb.apply is not a f

      本文链接:https://www.haomeiwen.com/subject/pxijultx.html