DEV Community

Cover image for How to fix "react-scripts" is not recognized as an internal or external command
Ayodeji Akintubi
Ayodeji Akintubi

Posted on

How to fix "react-scripts" is not recognized as an internal or external command

This error means react-scripts isn’t installed or isn’t properly accessible. Some solutions are:

a. Install react-scripts

The most common cause of this error is the absence of react-scripts. Install it:
npm install react-scripts
or
yarn add react-scripts

b. Check if you’re in the correct directory

Ensure you’re running the command from the root directory of your React project, where package.json and other related files are located. If you’re not in the root directory, navigate there with this command:
cd your-react-project-folder

c. Reinstall node_modules

Sometimes, a corrupt installation may trigger the problem. Fix it by deleting existing installations with this command:
rm –rf node_modules package-lock.json

Then, reinstall everything:
npm install

d.** Check your package.json**

Ensure react-scripts is listed in dependencies:

{
“dependencies”: {
“react-scripts”: “^5.0.1”
},
“scripts”: {
“start”: “react-scripts start”
}
}

If react-scripts exists, but it’s not version “^5.0.1”, but something like this:

install react-scripts as a dependency with this command:
Npm install react-scripts
Or
Yarn add react-scripts

The command will add react-scripts in package.json and install it in node_modules

After the installation, your package.json should look like this:
{
“dependencies”: {
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-scripts": "5.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}}

Why does ^0.0.0 happen?

This error occurs when:

  • npm cache corruption
  • Network issues during installation
  • Interrupted installation process
  • Version resolution conflict If the solutions above don’t fix the problem, recreate the project with: Npx create-react-app my-new-app

Then,
Cd my-new-app

After reinstalling and recreating the project, the command should work correctly.

If this helps you fix the error, kindly share your experience in the comment section.

Background image credit: Infy SKY

Top comments (0)