Strahinja Ajvaz
Strahinja Ajvaz

Reputation: 2643

Adding dependency gives error: 'react-scripts' is not recognized as an internal or external command, operable program or batch file"

Does anyone else get this issue? When i go to create a new project using create-react-app, and i add any dependency to it other than the stock ones, i.e. react-redux, redux, react-router-dom, i get the following error:

'react-scripts' is not recognized as an internal or external command, operable program or batch file.

I've tried building with different vs of the modules but that proved pointless.

Any advice on why would be amazing. The versions of the modules are the latest ones.

Upvotes: 2

Views: 4790

Answers (2)

Matthis Kohli
Matthis Kohli

Reputation: 1995

@Aniruddh Agarwal and Strahinja Ajvaz gave me the hint.

I did start to use yarn for a while but for reason a package name couldn't be installed properly with yarn. I switched to npm install and it worked fine. After trying to run the code it failed. I did npm uninstall package and after that tried yarn add package again. It succeded this time (strange) and the application did start as before.

Upvotes: 0

Aniruddh Agarwal
Aniruddh Agarwal

Reputation: 917

You are getting that error because you node_modules are either not present their or they are not installed properly because when you are trying to start app with

something start

then it runs the start script from package.json so install the node_ modules properly to start the react app. Run npm install in the project directory where your package.json is

Upvotes: 4

Related Questions