DEV Community

Motouom Victor
Motouom Victor

Posted on

2

npm run dev gives an error.

We often encounter the error below when trying to start our react app.


packit-frontend@0.0.0 dev
vite

file:///home/ariel/Desktop/PackIt/PackIt-frontend/node_modules/vite/bin/vite.js:7
    await import('source-map-support').then((r) => r.default.install())
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)
Enter fullscreen mode Exit fullscreen mode

This error is often caused by your node version being below the expected version. Below are some guides to help you fix that:

  1. check your node version.
node -v
Enter fullscreen mode Exit fullscreen mode
  1. if your node version is lower than version 21, I will recommend you install node 21 or greater.
nvm install 21
Enter fullscreen mode Exit fullscreen mode
  1. After the installation is done, you can now use the version 21.
nvm use 21
Enter fullscreen mode Exit fullscreen mode
  1. Run the app again with
npm run dev
Enter fullscreen mode Exit fullscreen mode

and the expected result should be:


> packit-frontend@0.0.0 dev
> vite


  VITE v5.3.4  ready in 222 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
Enter fullscreen mode Exit fullscreen mode

Sentry blog image

Identify what makes your TTFB high so you can fix it

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

Read more

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay