core: @poppinss/utils seems to be broken with node 12
Could it be that @poppinss/utils 3.0.5 doesn’t work with node 12 anymore?
Due to a new setup, I have node 12 installed, while previously working on node 15.
I have 2 adonisjs projects, one is older with @poppinss/utils 2.5.10
and newer one with @poppinss/utils 3.0.5
Running node ace
with poppins 2.5.10 wokrs as expected
However, running node ace
with poppins 3.0.5 gives me the following error:
/home/user/Node/myproject/node_modules/@poppinss/utils/build/src/Helpers/string.js:241
return `${values[0]}${options?.pairSeparator || ' and '}${values[1]}`;
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/user/Node/myproject/node_modules/@poppinss/utils/build/src/Helpers/index.js:56:31)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
I also tried to rule out that it has something to do with my project itself, and wanted to create a new adonis v5 project with npm init adonis-ts-app adonis5testsetup
and this produces the following error
CUSTOMIZE PROJECT
❯ Select the project structure · api
❯ Enter the project name · adonis5testsetup
❯ Setup eslint? (y/N) · true
❯ Setup prettier? (y/N) · true
RUNNING TASKS
❯ Scaffold project 41 ms
❯ Install dependencies 17 s
❯ Configure installed packages 14 ms
Unexpected token '.'
[ error ] Unable to create project. Cleaning up
UPDATE: just installed fnm
to try different versions, and it seems to be broken with node 13 too.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (6 by maintainers)
Yes, the error message appears because the version of Node.js you are using (the service that runs your code) does not know about the optional chaining operator.
It was added in Node.js 14. So it seems your application is running under a lower version of Node.js despite the container having version 16.5.0. 🤔
Have already mentioned. Please upgrade the Node version. React should move to atleast the LTS of Node, which is 14.15.x.
Or you can run different version for the React and different for AdonisJS. There are tools like Nvm and Volta, which allows this