Home > database >  create-next-app project : react-script is not recognized when running " npm run build "
create-next-app project : react-script is not recognized when running " npm run build "

Time:10-10

This is my package.json file:

  "name": "food-recipe",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "react-scripts build",
    "start": "next start"
  },
  "dependencies": {
    "@contentful/rich-text-react-renderer": "^15.4.0",
    "contentful": "^9.0.3",
    "next": "11.1.2",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  }
}

when I run : npm build this error is shown. enter image description here

CodePudding user response:

You don't need react-scripts when using create-next-app instead of :

"build": "react-scripts build",

do this :

"build": "next build",
  • Related