0

I have created the react application using npx create-react-app task-tracker and this is my package.json file when ever I run npm start it shows error. As I am new to React I hardly have any knowledge about it. this the error:

npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ASUS\AppData\Roaming\npm-cache\_logs\2021-04-19T15_13_05_651Z-debug.log

package.json:

{
  "name": "task-tracker",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "cra-template": "1.1.2",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-scripts": "4.0.3"
  }
}
Muskan
  • 1
  • 1
  • 1
    You are missing an "start" Script. Look here [link](https://stackoverflow.com/questions/31976722/start-script-missing-error-when-running-npm-start) – Carlotta Apr 19 '21 at 15:18

1 Answers1

0

It seems like create-react-app did not add the "scripts" field to the package.json object. I would try adding this field to package.json

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

If that doesn't work, try running create-react-app again

Oleks G
  • 94
  • 5
  • It's giving error and yes my create-react-app is not working properly public, src files are missing. – Muskan Apr 19 '21 at 15:55
  • I would recommend trying to reinitialize the project using create-react-app. Make sure you are running the command ```npx create-react-app yourappname``` – Oleks G Apr 19 '21 at 18:10
  • I actually did that but still facing the same issue – Muskan Apr 20 '21 at 07:21
  • 1
    Just for what it's worth, there was nothing remotely wrong with [the question you just deleted](https://stackoverflow.com/questions/67628681/does-javascript-closure-have-access-to-its-outer-outer-function), duplicate or not. Duplicates aren't necessarily a bad thing. They can help lead others to the answers to the original. Yours was both a well-observed and well-asked question. Happy coding! – T.J. Crowder May 20 '21 at 22:27
  • @T.J.Crowder oh ok I just thought that duplicates are basically the same thing as deleted. If it can help someone else I will undelete it. – Oleks G May 20 '21 at 23:15
  • @OleksG - Totally up to you. A good duplicate can increase the odds of someone finding their answer by showing up in a search: The person sees it, then follows the link to the earlier question, and finds the answer there. (Many others are definitely of no use and are best deleted.) It's not a big deal either way, I just didn't want you to think it was a dumb question. Totally wasn't. Anyway, happy coding! – T.J. Crowder May 21 '21 at 06:10