6

I'm doing the starter Next.js tutorial and encountering an error when I try to run the Next dev server and run my app.

Here is what my package.json file contains:

{
  "scripts": {
      "dev": "next dev"
  },
  "dependencies": {
    "next": "^12.2.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  }
}

When running npm run dev, I get the following error:

> @ dev /Users/renaudj/Documents/Projects/next-app
> next dev

/Users/renaudj/Documents/Projects/next-app/node_modules/next/dist/trace/report/index.js:14
    reporters = [];
              ^

SyntaxError: Unexpected token =
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `next dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/renaudj/.npm/_logs/2022-07-04T05_09_15_196Z-debug.log

Anyone know what I'm missing here? Thank you!

3
  • 3
    I'm guessing your Node version is less than 12.0. See Minimum Node.js version, you need at least 12.22.0 Commented Jul 4, 2022 at 5:38
  • Thanks, Phil. That was the issue. Commented Jul 4, 2022 at 20:51
  • That means that this docs page is wrong because it says minimum node version is 10.13 - nextjs.org/learn/basics/create-nextjs-app/setup Commented Aug 23, 2022 at 9:46

4 Answers 4

8

I update my node version V11.15.1 to V12.22.1 then it's solved

Sign up to request clarification or add additional context in comments.

Comments

0

I update my node version V10->V16. it' work

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Yes, updating your version of node will solve this issue.

Before doing this, delete the node_modules folder in your project.

Then to update node to the latest stable version, run the following command on your terminal:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

You may need to restart your terminal to see the version update which you check using:

node -v

Then reinstall your project using

npm install

Comments

-1
  1. Basically I have multiple versins of node.

  2. It is possible through nvm

  3. I switched to node 14 using the command :

    node use 14.15.0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.