reactjsvite

Syntax error while running vite create with npm


I'm trying to create a react project using vite but I'm getting an error while running npm create vite@latest I'm on a fresh new ubuntu, I've just created a directory, opened a terminal inside that directory then ran sudo apt install npm followed by npm create vite@latest but I'm getting this error:

enter image description here

What am I doing wrong? Since my setup is new have I forgotten to install something?


Solution

  • You're using a version of Node that vite@latest (currently Vite 3.x) no longer supports. Vite 3 requires Node 14.18 or newer:

    Node.js Support

    Vite no longer supports Node.js 12 / 13 / 15, which reached its EOL. Node.js 14.18+ / 16+ is now required.

    The solution is to install one of the supported Node versions on your machine, and retry the npm create vite@latest command afterward.