npm install results in "node not recognized as internal or external command"


Both node and npm is installed prior to running npm install

$ node
Welcome to Node.js v16.15.0.
Type ".help" for more information.

$ npm -v

npm install results in "node not recognized as internal or external command"

Console output:

$ npm install
npm WARN deprecated source-map-url@0.4.1: See
npm WARN deprecated source-map-resolve@0.6.0: See
npm WARN deprecated source-map-resolve@0.5.3: See
npm WARN deprecated urix@0.1.0: Please see
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixednpm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! 'node' is not recognized as an internal or external command,npm ERR! operable program or batch file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sebas\AppData\Local\npm-cache\_logs\2022-05-27T21_00_18_704Z-debug-0.log

full verbose output:

Further notes:

  • The result is the same independent of whether I use cmd or git bash
  • Removing node.js and reinstalling doesn’t work
  • Looking at the verbose output, it seems to be something to do with core-js?

user variables

enter image description here

system variables

enter image description here

Please help, Im going insane ;_;


Credit to @CherryDT

His answer helped me:

Long story short, if you have a file or "subdirectory of a file" in PATH then it can corrupt all paths underneath it.

In my case, I had an entry to choco.exe, so I just had to remove it:

enter image description here

Also, try to move the path that is not working all the way to the top.

Answered By – Sebastian Nielsen

Answer Checked By – Senaida (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.