'react-scripts' is not recognized as an internal or external command in React

Dung Do Tien Jun 04 2021 8

I have a project using Reactjs, and when I'm trying run applications with npm start or yarn start, I encounter an error with react-scripts as follows:

'react-scripts' is not recognized as an internal or external command,
operable program or batch file.

package.json file

{
  "name": "my-react-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.1"
  },
  // ... 
}

I installed react-scripts version 4.0.3 but it still not work for me. How can I resolve it?

Have 3 answer(s) found.
  • J

    Jair Rojas Garcia Jun 04 2021

    This error occurred because your NPM or Yarn program can’t find the react-scripts module, which should be installed in your node_modules folder.

    To fix this error try to re-install your dependencies with npm install or yarn command. The error should be fixed because react-scripts are now installed under node_modules folder.

    If the error still appears, try to delete your node_modules folder first, then re-install your dependencies:

    rm -rf node_modules/
    npm install

    Then you need to re-install the package using your package manager:

    npm install react-scripts
    # or
    yarn add react-scripts

    I hope it helpful for you!!

  • W

    Wittaya Suttisak Jun 04 2021

    it may be that your node_modules is corrupted.
    So you can run npm install  command and try again.

  • L

    Le Ba Tuan Anh Jun 04 2021

    It is an error about react-scripts file missing in your node_modules directory at the time of installation.

    Check your react-script dependency is available or not in package.json.

    If not available then add it manually via:

    npm install react-scripts --save

    And it worked for me!

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close