• Register
0 votes
186 views

Problem :

I am new to Programming. I have created a Maven Project, the JavaScript project is cloned as the git sub-module inside Maven Project. My directory structure is as below

mavenapp/src/main/javascript/[npm project files]

and inside the package.json my test is looking as below : 

"test": "react-scripts test --env=jsdom"

If I try to run the npm test then it is giving me below error:

“'React-scripts' is not recognized as an internal or external command,”

I have already tried to re-run the npm install But it is not working for me..

npm version : 5.5.1

node version : 9.3.0

How can I fix above error?

8 4 2
2,300 points

2 Answers

0 votes

Solution :

I had faced this error before. I have done research on it and then came up with below solution.

If you have the react-scripts in your package.json

If you are sure that you have seen  "react-scripts": "2.1.3" this in the pakage.json file then your job is very easy you just need to type below command

npm install

If you do not have the react-scripts  in your package.json

If you are sure that you have not seen   "react-scripts" this in your package.json file then maybe you have not yet installed it. So To install that you must type the below command

npm install react-scripts --save

And now you are completely set to go ahead.

5 2 1
4,980 points
0 votes

Solution:

It is an error about react-scripts file missing in your node modules directory at the time of installation.
Check your react-script dependency is avaliable or not in package.json

If not available then add manually via:

npm install react-scripts --save

or You can try

rm -rf node_modules && npm install

Wiping node_modules first, often tends to fix a lot of weird, package related issues like that in Node.

If react-scripts is present in package.json

If you see something like this "react-scripts": "2.1.3" in your pakage.json file then just type this command

npm install
If react-scripts is not present in package.json

If there is nothing like "react-scripts" in your package.json file then probably you have not installed it.To do that type the following command and you will be all set

npm install react-scripts --save

If none of the above solutions works and you have already installed the "react-scripts" package using

npm install react-scripts --save

You can try the below solution to run the application.

You should see the following in your package.json file

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
}

The script : "start": "react-scripts start" is linked to the file : nodemon node_modules/react-scripts/scripts/start.js which is used to start the project in the development env

Try to start the project directly using the below commands:

node node_modules/react-scripts/scripts/start.js

 

or if you have nodemon installed then try

nodemon node_modules/react-scripts/scripts/start.js

 

10 6 4
31,120 points

Related questions

0 votes
1 answer 1.2K views
1.2K views
Problem : I am beginner in the node.js .Currently I am trying to install node.js using the below command npm install nodemon --save. But when I try to run a server with below command nodemon server.js. then in my terminal I face below error: “Nodemon is not recognized as internal or external command, operable program or batch file”
asked Feb 13 mphil 2.3k points
0 votes
1 answer 11 views
11 views
Problem: I am very new to cordova, phonegap, ant,sdk,jdk. I am learning to use phonegap/cordova. Everything is installed properly on my machine i.e cordova, phonegap, ant,sdk,jdk. But now suddenly it started saying that: "’Node' is not recognized as an ... insufficient knowledge I am unable to fix this issue. I am looking for cordova and phonegap experts who can help me in fixing this issue.
asked Sep 2 Raphael Pacheco 4.9k points
0 votes
1 answer 922 views
922 views
Problem : I am new to type script and unable to compile my type script file. When I try to hit Ctrl+Shift+B in my VS Code, I face below error " ‘Tsc' is not recognized as an internal or external command, operable program or batch file." I used ... C:\Users\mphil\AppData\Roaming\npm\node_modules\typescript\bin\tsc C:\Users\mphil\AppData\Roaming\npm `-- typescript@2.1.5 How to fix above error?
asked Feb 15 mphil 2.3k points
0 votes
1 answer 49 views
49 views
Problem : Facing following Node.Js error 'npm' is not recognized as an internal or external command, operable program or batch file.
asked Nov 18, 2019 peterlaw 6.9k points
0 votes
2 answers 129 views
129 views
Problem : When ever I run mvn --version command from inside the bin it gives me the version but when I run it from the outside of bin it gives following exception : 'mvn' is not recognized as an internal or external command, operable program or batch file.
asked Nov 18, 2019 peterlaw 6.9k points