Setup
Create a new app
Scaffold a new Vite + React project. npm create vite@latest myfolder -- --template react, then install its dependencies.
myfolderis whatever you want the project folder to be named.--template reactskips Vite's interactive prompts and picks the plain React (JS) template directly.- The create command only scaffolds files, it doesn't install anything,
npm installis still a separate step.
bash
npm create vite@latest myfolder -- --template react
cd myfolder
npm installUse npm start instead of npm run dev
Vite's default dev script is named dev, not start. Add a start script in package.json so npm start works too.
- Open
package.json, find the"scripts"block. - Add
"start": "vite"next to the existing"dev": "vite"line. npm run devandnpm startnow do the exact same thing.
json
"scripts": {
"dev": "vite",
"start": "vite",
"build": "vite build",
"preview": "vite preview"
}