# How to fix ‘react-scripts’ is not recognized as an internal or external command

Have you ever run into the error that “‘react-scripts’ is not recognized as an internal or external command”? So in this post, we will show you the possible causes and sum up several simple methods to help you tackle with this problem.

## The reason for the “‘react-scripts’ is not recognized as an internal or external command” error

When you run the program with the command npm start or npm test with React project, the error ‘react-scripts’ is not recognized as an internal or external command that appears on the console. The output will look like the image below.

Output:

This error can happen when your program misses the react-scripts package in node_modules during project installation. You can follow the next part of the article to get your solutions.

### Installing react-scripts

Create-react-app makes use of the NPM package react-scripts. It’s a “black box” with the essentials inside:

• Dependencies: Webpack, ESLint, and Babel.
• Configuration: Webpack, Babel, and ESLint configuration files for both development and production environments.
• Scripts: Run react-scripts start, for instance, will start the Webpack server in the development environment and execute commands for this package.

This package will be installed into the application immediately once we install it, but it may be lost if you apply it wrong or delete it during development. You may reinstall it with the following command.

Terminal:

npm install react-scripts --save

After you installed, the package react-scripts can be recognized as an internal or external command, so the error will also be prevented. Therefore, We can run the project generally without any problems.

### Removing node_modules before running the program

In this way, you will use the command to delete the old node_modules that is missing the react-scripts package, then use the npm install command to reinstall it. NodeJS Module is a Javascript library that is like a collection of function objects and variables you can include in your application. Moreover, using Modules makes it simple to code and manage the code in your application. The program will reinstall us from scratch because it detects node_modules has been removed and is missing packages.

Code:

rm -rf node_modules && npm install

This will fix the missing react-scripts in the article, and any minor errors in the project or missing packages will also be fixed. Wish you success with the methods mentioned in the article.

## Summary

In summary, the article has shown you why 'react-scripts' is not recognized as an internal or external command error occurs and how you can solve it. However, I recommend removing node_modules before running the program because it will fix missing packages efficiently and comprehensively.

Maybe you are interested: