我一直在运行mocha测试,其中db使用knex填充。我正在改变其中一个测试并遇到了这个错误:
Knex:warning - Pool2 - Error: Pool was destroyed
Knex:Error Pool2 - Error: getaddrinfo ENOENT localhost:5432
Error: Pool was destroyed
at Pool._destroyPool (...\node_modules\pool2\lib\pool.js:548:20)
at Pool.<anonymous> (...\node_modules\pool2\lib\pool.js:465:18)
at Pool.<anonymous> (...\node_modules\pool2\lib\pool.js:505:17)
at tryCatcher (...\node_modules\knex\node_modules\bluebird\js\main\util.js:26:23)
at Promise.errorAdapter (...\node_modules\knex\node_modules\bluebird\js\main\nodeify.js:36:34)
at Promise._settlePromiseAt (...\node_modules\knex\node_modules\bluebird\js\main\promise.js:579:21)
at Promise._settlePromises (...\node_modules\knex\node_modules\bluebird\js\main\promise.js:697:14)
at Async._drainQueue (...\node_modules\knex\node_modules\bluebird\js\main\async.js:123:16)
at Async._drainQueues (...\node_modules\knex\node_modules\bluebird\js\main\async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (...\node_modules\knex\node_modules\bluebird\js\main\async.js:15:14)
我把测试改回了他们还在工作时的状态,但我无法摆脱错误,我尝试重新启动计算机并重新创建数据库,但我没有想法。其他人都知道如何解决这个问题吗?