'react-scripts' is not recognized as an internal or external command

I've got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks something like

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

inside my package.json, the test looks like this : "test": "react-scripts test --env=jsdom",

but when I try to run npm test is says

'react-scripts' is not recognized as an internal or external command,

Interestingly when I clone the javascript project independently I don't get this error. I've tried re-running npm install.

npm version : 5.5.1

node version : 9.3.0

Answers:

Answer

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

Answer

Have you tried:

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.

Answer

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

Answer

In my situation, some problems happened with my node package. So I run npm audit fix and it fixed all problems

Answer

i fix this issue :-), just uninstall your node.js and show hidden files

then go to "C:\Users\yourpcname\AppData\Roaming\

then delete the "npm" and "npm-cache" folder

and install a new version of node.js.

Answer

react-scripts is not recognized as an internal or external command is related to npm.

I would update all of my dependencies in my package.json files to the latest versions in both the main directory and client directory if applicable. You can do this by using an asterisk "*" instead of specifying a specific version number in your package.json files for your dependencies.

For Example:

"dependencies": {
    "body-parser": "*",
    "express": "*",
    "mongoose": "*",
    "react": "*",
    "react-dom": "*",
    "react-final-form": "*",
    "react-final-form-listeners": "*",
    "react-mapbox-gl": "*",
    "react-redux": "*",
    "react-responsive-modal": "*",
  }

I would then make sure any package-lock.json were deleted and then run npm install and yarn install in both the main directory and the client directory as well if applicable.

You should then be able to run a yarn build and then use yarn start to run the application.

Answer

I faced the same problem. But running the npm update command it's solved my problem.

Answer

I have tried many of the solutions to this problem found on line, but in my case nothing worked except for reinstalling NVM for Windows (which I am using to manage multiple Node versions). In the installer, it detects installed Node versions and asks the user if they wish for NVM to control them. I said yes and NVM fixed all PATH issues. As a result, things worked as before. This issue may have multiple causes, but corrupted PATH is definitely one of them and (re)installing NVM fixes PATH.

Answer

For Portable apps change

package.json

as follows

"scripts": {
    "start": "node node_modules/.bin/react-scripts start",
    "build": "node node_modules/.bin/react-scripts build",
    "test": "node node_modules/.bin/react-scripts test",
    "eject": "node node_modules/.bin/react-scripts eject"
  }
Answer

In my case, the problem had to do with not having enough file permissions for some files the react-scripts package installation was going to write to. What solved it was running git bash as an administrator and then running npm install --save react-scripts again.

Answer

When I make a new project using React, to install the React modules I have to run "npm install" (PowerShell) from within the new projects ClientApp folder (e.g. "C:\Users\Chris\source\repos\HelloWorld2\HelloWorld2\ClientApp"). The .NET core WebApp with React needs to have the React files installed in the correct location for React commands to work properly.

Answer

This is rather old question but this might be of some help for future reference. Delete node_modules folder and run npm install again. Worked for me.

Answer

Faced the same problem, although I am using yarn.

The following worked for me:

yarn install 
yarn start
Answer

In my case , I edited my files on Linux where I had node v14.0.5 installed, when I rebooted to Windows where I had node v14.0.3 I got the same error. So I updated the node version on windows and all went fine for me.

Answer

This is how I fix it

  1. Check and Update the path variable (See below on how to update the path variable)
  2. Delete node_modules and package-lock.json
  3. run npm install
  4. run npm run start

if this didn't work, try to install the nodejs and run repair

or clean npm cache npm cache clean --force

To update the path variable

  1. press windows key
  2. Search for Edit the system environmental variable
  3. Click on Environment Variables...
  4. on System variable bottom section ( there will be two section )
  5. Select Path variable name
  6. Click Edit..
  7. Check if there is C:\Program Files\nodejs on the list, if not add this

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.