react-scripts: command not found ( Solved )

If you are getting the react-scripts: command not found error then in this entire tutorial you will know how to solve the react-scripts: command not found error.

Solution of react-scripts: command not found  Error

Solution 1:

Open the particular terminal, open the root of your project, type ‘ npm install react-scripts’, and clear the npm cache if necessary.

Installing react-scripts
Installing react-scripts on terminal

If necessary, delete the package-lock.json file and the node module directory, load the restart dependencies and restart the development server.

 

When the terminal is open, run the following command in your project’s root directory (where the package.json file is located)::

installing using the npm command
installing using the npm command

All dependencies in the package.json file are installed as a result of the above command. If the first attempt fails, try running the install command again with the -force flag

Forcing to install the react srcipts
Forcing to install the react srcipts

 

Solution 2:

If the problem is not solved, try to execute “npm start” once the dependencies have been installed.

npm start

If again the problem is not fixed then try specifically installing the react-scripts package.

npm install react-scripts

Run the installation command again with the “-force” flag if it fails.

npm install react-scripts --force

Try deleting your “node modules” and “package-lock.json” (not “package.json”) files, running “npm install” again, then restarting your development server if that does not fix the problem.

rm -rf node_modules
rm -f package-lock.json
rm -f yarn.lock

npm cache clean --force

npm install

Please note that type the “npm start” command once again after installing the required dependencies. If it doesn’t work, check sure there are no special characters in the path to your project. When the project directory or path contains spaces, for instance, the error “react-scripts: command not found” appears.

Solution 3:

Assure that the directory is not labeled as “app#3” or “my react app” (both names contain spaces) (contains a hash). Utilize punctuation marks to separate them instead, such as “my-react-app.”

Open your “package.json” file and verify that it has the “react-scripts” package in the “dependencies” object if you’re still seeing the “react-scripts: command not found” problem.

The “react-scripts” package should be in the “dependencies” object in your “package.json” file, not globally installed or in your project’s “devDependencies.”

Try manually adding the lines and running “npm install” again or update the package to the most recent version.

npm install

Conclusion

React js is a JavaScript framework that allows you to build beautiful web applications easily. You can also use it as a building mobile webapplications also. If you are getting the react-scripts: command not found then the above method will solve the error.

Hi, I am CodeTheBest. Here you will learn the best coding tutorials on the latest technologies like a flutter, react js, python, Julia, and many more in a single place.

SPECIAL OFFER!

This Offer is Limited! Grab your Discount!
15000 ChatGPT Prompts
Offer Expires In:
close-link