In VS code my scripts don't have a start command i tried adding it manually but it won't run and the preview command does't show live reloads

19 views Asked by At
"scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },

this is my script

"scripts": {
    "start": " react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
} 

I tried using these scripts instead but it would show this error

> [email protected] start
> react-scripts start

Could not find a required file.
  Name: index.html

1

There are 1 answers

0
Mahendra Meghwal On

Make sure you have Vite installed as a dependency in your project. You can install Vite using:

npm install vite --save-dev

Update your start script in the scripts section of your package.json to use Vite:

"scripts": {
  "start": "vite",
  "build": "vite build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
}

Ensure that your Vite project has the required files, including an index.html file in the root of your project. If it's missing, you can create a basic index.html file after run the app with npm start