reactjs – react-scripts: command not found

reactjs – react-scripts: command not found

Firstly Delete package-lock.json file in your project folder.

And then install dependencies again by npm install. That should solve this issue.

This usually happens because of a bad npm packages installation (using npm and yarn at the same time?). It can be desperating, but if you try these steps, it should work.

1st solution:

Remove node_modules folder. At the projects root folder, run

> yarn
> yarn run start

2nd solution:

At the projects root folder, run

> yarn upgrade
> yarn
> yarn run start

Next time you want to add a dependency using create-react-app, I recommend you to use yarn add instead of npm install.
(Source: https://github.com/facebook/create-react-app/issues/1155)

reactjs – react-scripts: command not found

Delete the /node_modules directory and the package-lock.json file using the rm command:

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

Install react-scripts using the following command:

npm install react-scripts

Install the dependencies using the following command:

npm install

Start the local server by running the following command:

npm run start

Note: If you are a Linux user then dont forget to add the sudo command before npm.

Leave a Reply

Your email address will not be published. Required fields are marked *