When it comes to front-end application development, React is the first choice of most developers. You can use
If you are developing a React project then you may have come across the error
'react-scripts' is not recognized as an internal or external command, operable program or batch file while running the Node Program Manager (npm).
Steps to fix ‘react-scripts’ is not recognized as an internal or external command:
There are multiple reasons for which you may get
'react-scripts' is not recognized as an internal or external command error messages. This error message is related to npm and your npm may have not installed correctly or missing dependencies of “react-scripts” or mismatch of npm version.
Here is the list of all possible causes of this error message and the steps to get rid of it.
Step 1: Install “react-script”
If “react-script” is not present in your package then you may face this error message. Check the package.json file to see if there is an entry for the dependency of “react-script”.
If it’s not available then it means “react-script” is skipped or not installed correctly at the time of installation. Run the following command to install “react-script”.
npm install react-scripts -save
If “react-script” is present in package.json then run the following command in command prompt.
Step 2: Execute audit fix command
If you are still getting the same error, execute the below command and see whether it able to solve the error. The audit fix returns exit code 0 if there are no issues or it successfully fixed all errors.
npm audit fix
Read also: gcc is not recognized as an internal or external command
Step 3: Clean npm cache and update npm
The error can be a cache issue on npm. Here is the command to clear the npm cache.
npmcache clean --force
After clearing the npm cache, run the below command to update npm.
Step 4: Re-Install node.js
If all the above-mentioned steps did not work for you then try reinstalling the node.js. Clear all the cache files and then install the latest version of node.js.
These are all the possible ways to get rid of “‘react-scripts’ is not recognized as an internal or external command error messages”. We hope this fixed the error and you are able to run the react application successfully.
Do let us know which method worked for you in the comment section. Happy learning !