AssertionError [ERR_ASSERTION]:无效的寄存器选项“value”必须是对象
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AssertionError [ERR_ASSERTION]:无效的寄存器选项“value”必须是对象相关的知识,希望对你有一定的参考价值。
我正在尝试设置nodeJS应用程序。使用Hapi和PostgreSQL DB。提到所有文件,但错误仍然存在。而server.register
server.register({
register: require('hapi-node-postgres'),
options : {
connectionString: "Postgresdb://dbuser:dbpassword@localhost/dbName"
}
}, err => {
console.log(err);
});
即将发生的错误是:
UnhandledPromiseRejectionWarning: ***AssertionError [ERR_ASSERTION]: Invalid register options "value" must be an object
at Object.exports.apply*** (/home/sc/code/Reporting(proto)/node_modules/hapi/lib/config.js:22:10)
at internals.Server.register (/home/sc/code/Reporting(proto)/node_modules/hapi/lib/server.js:367:26)
at Object.<anonymous> (/home/sc/code/Reporting(proto)/index.js:16:8)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
(node:15989) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15989) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
请协助。我正在使用“hapi”:“^ 17.5.3”“hapi-node-postgres”:“^ 4.1.0”
答案
您正在使用v16选项注册插件,因为该方法不再支持v17尝试此link
以上是关于AssertionError [ERR_ASSERTION]:无效的寄存器选项“value”必须是对象的主要内容,如果未能解决你的问题,请参考以下文章
为啥我在 Selenium 中收到 AssertionError?