Closed YoofiBP closed 2 years ago
This error occurs when using Node < v14 Upgrade Node to v14+ to fix
It would have been good if there was message to upgrade node to 14+ instead of Unexpected token '?'
. 🙂
It would have been good if there was message to upgrade node to 14+ instead of
Unexpected token '?'
. 🙂
we do, the problem is that the message wasn't visible due to the cli having the unexpected token 🙃
This error also happens to newcomers with npx create-remix@latest
. It would be nice to show friendly error message, or mention that on the getting started page https://remix.run/docs/en/v1
I'm on Node 16.13 and npm 8.8 and I still get this error (Mac).
npx create-remix --template remix-run/indie-stack blog-tutorial /Users/jason/.npm/_npx/82f938b29eb562d9/node_modules/@remix-run/dev/cli/run.js:68 return (process.env.npm_user_agent ?? "").split("/")[0] || "npm"; ^
SyntaxError: Unexpected token '?'
I hit the same error then installed Node 18 and it works now
If you use their Gitnode remote dev environment, what you have installed locally doesn't matter.
(Hint: the terminal prompt should look like this gitpod /workspace/indie-stack
if you're in gitpod vs local)
But if you're running the app locally then... here's what worked for me.
When running node on a Mac that was installed via Homebrew, make sure that the node version you're running is the one you need.
node --version
in my case was returning v12.x
Adding a set of aliases that allows you to switch node versions easily is a good idea I found here. Switching to the compatible version fixed the issue:
alias node19='export PATH="/usr/local/opt/node@19/bin:$PATH"'
alias node18='export PATH="/usr/local/opt/node@18/bin:$PATH"'
alias node16='export PATH="/usr/local/opt/node@16/bin:$PATH"'
alias node13='export PATH="/usr/local/opt/node@13/bin:$PATH"'
alias node12='export PATH="/usr/local/opt/node@12/bin:$PATH"'
Run:
node18
node --version
v18.12.1
Then run the setup command:
npx create-remix@latest --template remix-run/indie-stack blog-tutorial
What version of Remix are you using?
1.2.3
Steps to Reproduce
Follow steps in the Remix tutorial up until 'Loading Data' section Stop projct. Rerun project
Expected Behavior
Remix app is served on port
Actual Behavior
node_modules/@remix-run/dev/cli.js:325 appTemplate: flags.template ?? answers.appTemplate, ^
SyntaxError: Unexpected token '?'