3

I have been shifting between node versions 10.17.0 and 16.14.0(the latest version) since I work with SharePoint Framework which only supports node version 10.x.x. Now I have shifted back to the latest node version but when trying to run any of my React apps with the command npm start, I am facing with this error:

enter image description here

I have tried everything like uninstalling and reinstalling node on my computer, removing node_modules and package-lock.json files and doing npm install command but still get the error when trying to run my app with npm start.

Same problem applies whether I run npm start in windows cmd or Visual Studio Codes terminal.

Do you guys have any suggestion on what I should do? Thanks in advance.

EDIT: I have tried everything like as Abbas Hussain said and also uninstalling and reinstalling Node but I am still facing this error.

kelank
  • 147
  • 1
  • 2
  • 7

2 Answers2

0

I managed to solve it. There was a problem with the bash file so I did this in cmd:

npm config set script-shell "C:\Program Files\Git\bin\bash.exe"

And reinstalled node and npm so after that it worked fine!

kelank
  • 147
  • 1
  • 2
  • 7
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 09 '22 at 17:35
-1

I think I have faced a similar issue before the step that I follow

  • delete /node_modules
  • delete package-lock.json or yarn-lock.json
  • run this command npm cache clean --force or yarn cache clean
  • npm install or yarn

Hope this will resolve your issue

Abbas Hussain
  • 1,277
  • 6
  • 14
  • Abbas Hussain, I have tried that but it did not work for me. It gives me the same error when I come to npm install – kelank Mar 08 '22 at 19:59
  • https://github.com/npm/npm/issues/17444#issuecomment-311522791 maybe this is problem try to close all the node task and then follow above commands. – Abbas Hussain Mar 08 '22 at 20:04
  • https://stackoverflow.com/a/49620827/10939373 – Abbas Hussain Mar 08 '22 at 20:06
  • I have tried everything here but no luck – kelank Mar 08 '22 at 21:56
  • I even tried creating a new react app now but even that gives me the same error. I don't understand what is wrong. – kelank Mar 08 '22 at 22:47
  • I have also added "C:\Program Files\nodejs\" to PATH field in my environment variables but still getting the same error. – kelank Mar 09 '22 at 07:52
  • I had NVM installed on my computer and have understood that all node related files end up in NVM folder so I uninstalled NVM, uninstalled Node and NPM and the reinstalled Node and NPM but still get the same error. Help me, this is driving me crazy! – kelank Mar 09 '22 at 09:12