Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无效的寄存器选项";“价值”;必须是nodejs中的对象_Node.js_Hapijs - Fatal编程技术网

Node.js 无效的寄存器选项";“价值”;必须是nodejs中的对象

Node.js 无效的寄存器选项";“价值”;必须是nodejs中的对象,node.js,hapijs,Node.js,Hapijs,当我尝试运行我的nodejs应用程序时,我收到以下未处理的拒绝错误: (node:8645) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: Invalid register options "value" must be an object at Object.exports.apply (/home/igniva-js-vaibhav/Official/project/testProject/node

当我尝试运行我的nodejs应用程序时,我收到以下
未处理的拒绝
错误:

(node:8645) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: Invalid register options "value" must be an object
    at Object.exports.apply (/home/igniva-js-vaibhav/Official/project/testProject/node_modules/hapi/lib/config.js:22:10)
    at internals.Server.register (/home/igniva-js-vaibhav/Official/project/testProject/node_modules/hapi/lib/server.js:352:26)
    at Object.<anonymous> (/home/igniva-js-vaibhav/Official/project/testProject/index.js:44:8)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:193:16)
(node:8645) 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:8645) [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.
(节点:8645)未处理的PromisejectionWarning:AssertionError[ERR_ASSERTION]:无效的寄存器选项“value”必须是对象
在Object.exports.apply(/home/igniva js vaibhav/Official/project/testProject/node_modules/hapi/lib/config.js:22:10)
在internals.Server.register(/home/igniva js vaibhav/Official/project/testProject/node_modules/hapi/lib/Server.js:352:26)
反对。(/home/igniva js vaibhav/Official/project/testProject/index.js:44:8)
在模块处编译(Module.js:660:30)
在Object.Module.\u extensions..js(Module.js:671:10)
在Module.load(Module.js:573:32)
在tryModuleLoad时(module.js:513:12)
在Function.Module.\u加载(Module.js:505:3)
位于Function.Module.runMain(Module.js:701:10)
启动时(bootstrap_node.js:193:16)
(节点:8645)未处理的PromisejectionWarning:未处理的承诺拒绝。此错误源于在没有catch块的异步函数中抛出,或者拒绝未使用.catch()处理的承诺。(拒绝id:1)
(节点:8645)[DEP0018]弃用警告:未处理的承诺拒绝已弃用。将来,未处理的承诺拒绝将使用非零退出代码终止Node.js进程。

我认为这是直截了当的。我假设您正在启动服务器?传递给它的值必须是对象。 Hapi需要一个对象来配置服务器。任何其他值都将抛出错误

const server=Hapi.server({load:{sampleInterval:1000}})


从他们的文档来看,

我认为这是直截了当的。我假设您正在启动服务器?传递给它的值必须是对象。 Hapi需要一个对象来配置服务器。任何其他值都将抛出错误

const server=Hapi.server({load:{sampleInterval:1000}})


从他们的文档来看,

也许你现在已经解决了这个问题,但是。。。 我也有同样的问题,因为注册无效:

server.register(
        require('hapi-auth-cookie'**)**, (er) => { });
HapiJS中正确的依赖项注册为:

server.register(
        require('hapi-auth-cookie', (er) => { }));

也许你现在已经解决了这个问题,但是。。。 我也有同样的问题,因为注册无效:

server.register(
        require('hapi-auth-cookie'**)**, (er) => { });
HapiJS中正确的依赖项注册为:

server.register(
        require('hapi-auth-cookie', (er) => { }));