Joi: Joi v15.0.1 not working on node v6.9.1

Created on 1 May 2019  路  11Comments  路  Source: sideway/joi

Context

  • node version: 6.9.1
  • joi version: 15.0.1
  • environment (node, browser): node
  • used with (hapi, standalone, ...): hapi
  • any other relevant information:

What are you trying to achieve or the steps to reproduce ?

const Joi = require('@hapi/joi');

Which result you had ?

node_modules/@hapi/joi/lib/types/object/index.js:254
!pattern.schema._validate(key, state, { ...options, abortEarly:true }).errors) {
^^^
SyntaxError: Unexpected token ...

What did you expect ?

successful require

non issue

All 11 comments

+1

Node 6 is not supported. You have 3 options:

  • Upgrade your node version and use latest joi
  • Use version 12 which is no longer supported but will work with a warning message when installed
  • Get a hapi paid support plan and use the supported commercial version 12 (http://hapi.im/commercial)

Thanks for the reply @hueniverse ,v15.0.0 worked fine with node v6.9.1 , am I mistaken to think so ? can you direct me to a resource so I can check what features would not work with v15.0.0 as for my use case it works fine. for now I have updated my package.json with exact version I would want want to know if my app can break with v15.0.0 on node v6.9.1

I don't know. Not supporting it means exactly that. You are free to experiment and try to figure out why it is no longer working.

@rjdp https://github.com/hapijs/joi/compare/v15.0.0...v15.0.1#diff-3063cd3662b8c3bd5de2439f2ef8ee68R254 is likely the change that broke you in node 6.

+1

Same error with
node 10.13.0
joi 15.0.3

I believe I solved this by uploading node with the latest version.

I believe I solved this by uploading node with the latest version.

As was advised in @hueniverse's reply.

Same error with node 10.13.0

Node supports object spreading since 8.6, that's highly unlikely.

@Marsup
I am using joi in connection with cra.
The only solution for me was to replace '@hapi/joi' with 'joi-browser'.
'joi' did not work also, because of https://github.com/hapijs/hoek/issues/207

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

mohamadresaaa picture mohamadresaaa  路  3Comments

ashrafkm picture ashrafkm  路  3Comments

sergibondarenko picture sergibondarenko  路  3Comments

REBELinBLUE picture REBELinBLUE  路  3Comments

jamesdixon picture jamesdixon  路  4Comments