puter
puter copied to clipboard
`SyntaxError: Unexpected token '?'` after `npm start`
Hi When I start puter with $ npm start obtain this error:
"$ npm start
[email protected] start nodemon --exec "node dev-server.js"
[nodemon] 3.1.0
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,json,mjs,jsx,svg,css
[nodemon] starting node dev-server.js
/home/seby/puter/dev-server.js:9
const env = argv[2] ?? "dev";
^
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 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 [nodemon] app crashed - waiting for file changes before starting..."
Hi!
Can you share what version of node.js you're using? That's node --version
in a terminal. It sounds like you might be using a version that's too old.
Hi thi is the version of node v12.22.9 npm v8.5.1 in ubuntu 22.04.
Hello! Same problem here, I checked the versions of the SW and we have the same ones.
Ah yeah, that sounds like the issue then. I don't know the exact minimum version we require, but version 18 is the lowest that's currently supported by Node, according to their release schedule, and version 20 or higher is recommended there. I know in the Phoenix repo that version 18 wasn't enough.
Looks like the one in the apt repo for 22.04 is v18.17.1. But there's a guide here that looks good, for getting a higher version. I'm on Ubuntu 22.04 and I can't remember what I did to update mine.
Thanks for you quick response, I`ll try to upgrade the version of Node in my VM and keep working.
Thanks once again!
Just to @BadSeby : I managed to solve this via the following comands:
npm install -g n
n lts
hash -r
node --version
And now I have node-v20.11.1
Thanks, works for me.
Great! Good to know that's the only problem. :^)
We can do better, I think npm start
should have better error messages for common issues during first-time run. I'm happy to add this myself, I added an issue here to track it.