. Advertisement .
..3..
. Advertisement .
..4..
Jordane Walke, a software developer for Facebook, published React.js in 2011. React is a JavaScript package with a technique that uses components to build declarative user interfaces (UIs). It is applicable to both web and mobile apps and is utilized for managing the view layer. “‘React-scripts’ is not recognized as an internal or external command” is a common error that appears in many ways. In this blog, we will give you some useful information about the cause of it and how to fix it. Let’s read our blog to open your knowledge.
When Do You Get The Error ‘react-scripts’ is not recognized as an internal or external command?
When you attempt to use react-script, you may encounter the following error.
'react-scripts' is not recognized as an internal or external command
This issue happens because the module of react-scripts , which should be set up in your node modules folder, can’t be found by Yarn program or your npm. When you use the Create React App command-line tool to create a new React application, the react-scripts package is assumed to be installed. This is the reason why you get the error “‘react-scripts’ is not recognized as an internal or external command”.
How To Fix The Error “‘react-scripts’ is not recognized as an internal or external command”
Method 1: Manually set up react-scripts
The most common cause of this issue is a lack of react-scripts files in node modules, hence the simplest and most straightforward fix is to manually install react-scripts by using this command:
npm install react-scripts --save
Method 2: Remove your node_modules and package-lock.json files
If the error still persists, let’s try to remove your package-lock.json (not package.json) and node modules files, running npm install again, then restarting your IDE. Look at the following example to understand more this solution:
👇️ remove node_modules and package-lock.json
rm -rf node_modules rm -f package-lock.json
👇️ clean npm cache
npm cache clean --force
npm install
To avoid the error still occurs, make sure that you restart your IDE and development server. Rebooting the computer can occasionally fix VSCode’s bugs.
Method 3: Create a terminal window in the root directory of your project
Creating a terminal window in the root directory of your project and running the npm audit fix
command is a great solution for you to fix the error “‘react-scripts’ is not recognized as an internal or external command”. Let’s do as the following:
npm audit fix
The npm audit repair command scans the package tree for vulnerabilities and fixes them.
Method 4: Look over your box. json
Excepting the methods mentioned above, there is another method for you to fix the error “‘react-scripts’ is not recognized as an internal or external command”. It is looking over your box. json. Let’s follow these steps:
First, simply verify whether react-scripts are present in your package.json.
If package.json contains react-scripts, all you have to do is run npm install to fix the problem. Simply issue this command.
npm install
Simply run this command to install react-scripts if package.json is missing it.
npm install react-scripts --save
Method 5: Different approach
Simply run the following command.
rm -rf node_modules
After that,
npm install
OR direct-install react-script
npm install react-scripts --save-dev
After finishing these steps, your error will be completely resolved.
Conclusion
Above are some solutions to rhandle when you encounter ‘react-scripts’ is not recognized as an internal or external command. This is a common error that many programmers get. Find out how to handle it and choose the right solution for the situation you are in. Hope you get the problem resolved soon. If you have any questions, don’t hesitate to contact us immediately. Thank you for reading!
Read more
→ How to solve the error “sh: react-scripts: command not found”
Leave a comment