在终端中运行命令“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。我完全不知所措。我学到了很多东西,但没有什么能让我越过这堵墙。谁能帮我解决这个问题?