Hapi: SyntaxError: Unexpected identifier

Created on 29 Nov 2017  路  8Comments  路  Source: hapijs/hapi

I get this error:

node_modules/hapi/lib/server.js:251
    async inject(options) {
          ^^^^^^
SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/hapi/lib/index.js:5:16)

How to solve it?
Thanks in advance

non issue

Most helpful comment

@gubi what version of node are you using? You can find out by running node -v. Hapi needs node>=8.9.0 as defined here https://github.com/hapijs/hapi/blob/v17.1.1/package.json#L18

All 8 comments

@gubi what version of node are you using? You can find out by running node -v. Hapi needs node>=8.9.0 as defined here https://github.com/hapijs/hapi/blob/v17.1.1/package.json#L18

$ node -v
v9.2.0

@hueniverse this is an issue, I can't use your code for a new project (from scratch)

@gubi While this may be an issue to you, it is not a hapi issue.

If you need help how to use it, you can try the discuss repo.

its issue to me as well.

+1

You are all very likely using an outdated nodejs version, hapi is working perfectly fine for many others. Try logging the process.version at the very beginning of your process, and then only if it's 8.9+, we'll have a look. If you have no additional information to add, please refrain from commenting.

I also run into this problem with [email protected]. I uninstalled that particular version of node and reinstall it and the problem resolved by itself.

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hueniverse picture hueniverse  路  4Comments

RohovDmytro picture RohovDmytro  路  4Comments

jney picture jney  路  4Comments

kevinsimper picture kevinsimper  路  4Comments

mateeyow picture mateeyow  路  5Comments