Knex 迁移错误 .spread() 不是函数

Knex Migration Error .spread() Not a function

当在终端中 运行 命令 'knex migrate:latest' 时出现此错误...

➜  WebpackExpressKnexPackage git:(knexInit) ✗ knex migrate:latest
Using environment: development
/usr/local/lib/node_modules/knex/bin/cli.js:127
      pending = initKnex(env).migrate.latest().spread(function(batchNo, log) {
                                               ^

TypeError: initKnex(...).migrate.latest(...).spread is not a function
    at Command.<anonymous> (/usr/local/lib/node_modules/knex/bin/cli.js:127:48)
    at Command.listener (/usr/local/lib/node_modules/knex/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:210:5)
    at Command.parseArgs (/usr/local/lib/node_modules/knex/node_modules/commander/index.js:653:12)
    at Command.parse (/usr/local/lib/node_modules/knex/node_modules/commander/index.js:475:21)
    at Liftoff.invoke (/usr/local/lib/node_modules/knex/bin/cli.js:186:13)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/knex/node_modules/liftoff/index.js:198:16)
    at module.exports (/usr/local/lib/node_modules/knex/node_modules/flagged-respawn/index.js:17:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/knex/node_modules/liftoff/index.js:190:9)
    at /usr/local/lib/node_modules/knex/node_modules/liftoff/index.js:164:9
    at /usr/local/lib/node_modules/knex/node_modules/v8flags/index.js:108:14
    at /usr/local/lib/node_modules/knex/node_modules/v8flags/index.js:35:14
    at /usr/local/lib/node_modules/knex/node_modules/v8flags/index.js:47:7
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

我已经从我的计算机上完全删除了所有 Brew 和 NPM,重新安装它们并完全重写了我的服务器几次,希望找到解决方案,但在每个角落我都会遇到同样的错误,.spread () 不是函数。

在这里你可以看到我是 运行 当前版本的 Knex.js:

➜  WebpackExpressKnexPackage git:(knexInit) ✗ knex -V
Knex CLI version:  0.14.2
Local Knex version:  0.21.16

但是,我不知道如何卸载 Knex-Cli:

➜  WebpackExpressKnexPackage git:(knexInit) ✗ npm uninstall --save knex
removed 32 packages and audited 714 packages in 2.558s
found 0 vulnerabilities

➜  WebpackExpressKnexPackage git:(knexInit) ✗ knex -V
Knex CLI version:  0.14.2
Local Knex version:  undefined

我看到一个线程提到它可能是遗留的 Bluebird 代码,但在任何人提供答案之前该线程已关闭。希望问题出在 Knex CLI 中,我已成功卸载 Knex,但无法删除 Knex CLI。 我完全不知所措。我学到了很多,但没有什么能让我越过这堵墙。谁能帮我解决这个问题?

你试过了吗运行npm uninstall -g knex

我对机器内部工作原理的了解有限。在改变路径和 installing/uninstalling/updating 四年之后(谁知道我还犯了其他什么错误;也就是说,我到处都是无用的 package.json 文件),我得出的结论是我需要从头开始。我最终完全恢复了出厂设置,没有使用任何备份,然后从头开始重新安装 Homebrew 和 Node(以及我需要的其他库)。我不确定,但我的理论是我的机器太拥挤了,以致于不知何故混淆了自己。我不能确定这就是问题所在,但恢复出厂设置是一个有效的解决方案。

感谢大家的意见。