不知何故,我的sails.js 1.x 环境已经被破坏到我不再能够对我的PostgreSQL 数据库进行本机查询的地步。我确定问题出在某个包的版本上,因为我在周末对 NodeJS 9 进行了一些实验,但是这段代码在周五工作,我看不到问题所在。有什么建议么?
sails> sails.getDatastore().sendNativeQuery('SELECT COUNT(*) FROM "user"').then(console.log);
Promise {
_bitField: 0,
_fulfillmentHandler0: undefined,
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined }
sails> UsageError: Sorry, this function doesn't know how to handle {...} callbacks.
If provided, the 2nd argument should be a function like `function(err,result){...}`
| If you passed in {...} on purpose as a "switchback" (dictionary of callbacks),
| please be aware that, as of machine v15, you can no longer pass in a switchback
| as the 2nd argument. And you can't pass a switchback in to .exec() anymore either.
| Instead, you'll need to explicitly call .switch().
[?] See https://sailsjs.com/support for help.
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:133:24
at _makeCallToDuringFn (/Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:101:28)
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:103:7
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/sails-hook-orm/lib/datastore-method-utils/private/do-with-connection.js:66:14
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/machinepack-postgresql/node_modules/machine/lib/private/help-build-machine.js:966:24
at Function.handlerCbs.success (/Users/patrick/src/healthcelerate/hc-registry/node_modules/machinepack-postgresql/node_modules/machine/lib/private/help-build-machine.js:826:26)
at cb (/Users/patrick/src/healthcelerate/hc-registry/node_modules/machinepack-postgresql/machines/get-connection.js:87:20)
at BoundPool.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg-pool/index.js:137:9)
at bound (domain.js:301:14)
at runBound (domain.js:314:12)
at /Users/patrick/src/healthcelerate/hc-registry/node_modules/generic-pool/lib/generic-pool.js:347:9
at BoundPool.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg-pool/index.js:103:7)
at Connection.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg/lib/client.js:158:7)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:121:20)
at Connection.emit (events.js:211:7)
at Socket.<anonymous> (/Users/patrick/src/healthcelerate/hc-registry/node_modules/pg/lib/connection.js:121:12)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:607:20)
sails>
任何提示或想法都会被广泛接受。