skip to Main Content

I’m trying to start a React project with npm start and the following error is shown:

$ npm start

> [email protected] start
> react-scripts

Unknown script "undefined".
Perhaps you need to update react-scripts?
See: https://facebook.github.io/create-react-app/docs/updating-to-new-releases

I have updated react-scripts to last version, npm install, even I pulled a version of the project without the previous changes and still the error is shown.

I share the package.json. I appreciate any help and suggestions in advance.

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.6",
    "@testing-library/react": "^11.2.1",
    "@testing-library/user-event": "^12.2.2",
    "axios": "^0.21.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-input-range": "^1.3.0",
    "react-redux": "^7.2.4",
    "react-router": "^5.2.1",
    "react-router-dom": "^5.2.1",
    "react-scripts": "^5.0.1",
    "redux": "^4.1.1",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.3.0",
    "styled-components": "^5.3.1",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "react-scripts",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}```

2

Answers


  1. Use npm run start.

    If that doesn’t work, try removing your package-lock.json and node_modules folder, then run npm install and try again.

    Login or Signup to reply.
  2. Add start to "react-scripts".
    i.e.
    "scripts": {
    "start": "react-scripts start",
    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search