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

Issue

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
8.11.0

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 https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
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: https://ctxt.io/2/AADgZHqcEg

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 ;_;

Solution

Credit to @CherryDT

His answer helped me: https://stackoverflow.com/a/70452751/7123519

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.