这个语法错误是什么?(测试Hapi.js)

What is this syntax error ? (Testing Hapi.js)

本文关键字:测试 Hapi js 语法 错误 是什么      更新时间:2023-09-26

我只是想测试Hapi.js,无论我编码什么,我都会收到这个错误:

node_modules/hapi/lib/server.js:145
        Items.serial(this.connections, (connectionItem, next) => {
                                                            ^
SyntaxError: missing ) after argument list
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:413:25)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/gilles/exo1/node_modules/hapi/lib/index.js:5:16)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)

这个语法从哪里来。。。()=>{…生成函数?
我用哈皮做了什么坏事?

非常感谢

语法称为Arrow函数。您使用hapi 10或更高版本,它需要节点4+,但您有一个旧版本的节点,它还不支持箭头功能。解决方案是将节点版本升级到4或5。