0

I created a new app using the react template. In my github actions, When I first did the npm install, it went well Later I tried, the npm run build . It failed with npm ERR! Missing script: "build" But the build script is present in my package.json file

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
Ahmed Sbai
  • 10,695
  • 9
  • 19
  • 38
indra257
  • 66
  • 3
  • 24
  • 50
  • 1
    Make sure you are running the command from the folder containing your package.json file also make sure you don't have duplicate `scripts` properties there – Ahmed Sbai Jul 18 '23 at 14:12
  • @Hatana yes, I am running in the same folder. And yes there is only one scripts properties. But looks like I am missing something here. I tried difference things like clean cache and all but it didn't work – indra257 Jul 18 '23 at 15:31

1 Answers1

1

Verify react-scripts installation: The react-scripts package typically provides the build script, which is a development dependency. Confirm that react-scripts is correctly listed under devDependencies in your package.json file. If it's missing, you can install it by running:

npm install react-scripts --save-dev
MfyDev
  • 439
  • 1
  • 12
  • it is listed in my dev dependecies "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "eslint-config-react-app": "^7.0.1", "jest-editor-support": "^31.0.1", "react-scripts": "^5.0.1" } – indra257 Jul 18 '23 at 15:29
  • @Petr the `start` script is working so react-script should be installed – Ahmed Sbai Jul 18 '23 at 15:42