Home > Back-end >  npm ERR! Missing script: "start"
npm ERR! Missing script: "start"

Time:05-29

I'm newbie to react js.Trying to run a simple app and getting this error and can't figure out what's wrong

D:\React app\react-app1>npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Muralidharan\AppData\Local\npm-cache\_logs\2022-05-29T08_51_37_315Z-debug-0.log

This is package.json file

{
  "name": "react-app1",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-scripts": "5.0.1"
  }
}

CodePudding user response:

This happens becaue you have no script called "start" in your package.json file. Here is an example of a package.json file with such script:

{
  "name": "your-project",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "start": "node main.js"
  },
  "author": "Muralidharan",
  "dependencies": {
  }
}

CodePudding user response:

add this to your package.json

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

start is the command you need that trigger react-script to run your project build, test and eject are other command you will need for development process

CodePudding user response:

Thanks to all who answered the question, the issue was with the outdated version So I have done this to resolve

1. npm uninstall -g create-react-app
2. npm install create-react-app  ( v1.5.2 is outdated and no longer supported            
  • Related