Node cannot find path in node_modules / 'react-scripts' is not recognized as an internal or external command

Viewed 32

I'm on windows 10

When I run: npm run start or npm start

I get an error:

npm start

> app-test@0.1.0 start
> react-scripts start

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

What I already tried:

  1. npm ci

  2. remove node_modules and reinstall project

  3. npm audit fix

  4. run command from elevated PowerShell (as admin)

  5. Uninstall Node v.18 win NVM and reinstall common Node installation LTS v.16

  6. Check if react scripts is on dependencies section in package.json - and it's of course there.

  7. Recreate project itself and also create a fresh new React project with npx create-react-app

  8. Clearing npm cache

Nothing's helped me.

BUT This project runs fine WHEN I explicitly tell the node path to subfolder with a script:

app-test> node node_modules/react-scripts/scripts/start.js


Compiled successfully!

You can now view app-test in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.91.1:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

webpack compiled successfully

What's interesting that an old React projects also resided in the parent folder starts normally even I renew node_modules in these projects doing them npm i or npm ci

But any time I try to create and start new React app command npm start fails UPD1: Tried to create-react-app on any other drive or folder. And it's running ok. So culprit seems permissions policies in my common working directory ?

UPD2: I resolved a problem though still have no clear idea who was actually the really culprit of this bug.

I copied all my parent developer folder with all code examples to another drive, then tried to create react app there and out of the blue it worked fine at then new location.

Also I removed this original folder from the drive where it used to be. And do git clone "..." at this directory< recreating the exact structure as it was before all experiments. Then I tried create-react-app exactly at that location as I've unsuccessfully tried before swapping folders and it was OK ! Tried couple of time with different folder location within parent directory and all sill working fine now !

I remembered now I already have such bug before. And I had to reinstall Windows that time.

I also want to mention that I also have another machine with Windows, another one with Linux and had also laptop with an OSX so I can ( or could) push to this very git repository from any of these computers.

Suggestion of somebody who have any idea, why this bug was happening repeatable would be highly appreciated.

Thanks.

0 Answers
Related