Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! Missing script: "build"

Tags:

npm

reactjs

I am trying to deploy a react project but did not use create-react-app to start the project i used a site called createapp.dev so i don't know if that is the issue. i included my package.json and an image of the error is as follows "Error"

    "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "clean": "rm dist/bundle.js",
    "start": "react-scripts start",
    "build-prod": "parcel build src/index.html"
  },
  "dependencies": {
    "node-sass": "^7.0.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.18.5",
    "@babel/preset-env": "^7.18.2",
    "@babel/preset-react": "^7.17.12",
    "gh-pages": "^4.0.0",
    "parcel-bundler": "^1.12.5",
    "prettier": "^2.7.1"
  }
}
like image 370
Tobi_009 Avatar asked Jan 28 '26 10:01

Tobi_009


2 Answers

You don't have a script called "build" in your package.json. Try with "build-prod" instead!

like image 93
Aymendps Avatar answered Jan 30 '26 02:01

Aymendps


npm run build means to run the script called build from that list you provided. Your list doesn't have a script called build, so it fails.

like image 44
Slbox Avatar answered Jan 30 '26 02:01

Slbox



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!