Home > Enterprise >  npm is not recognized as a command in the middle of npm install
npm is not recognized as a command in the middle of npm install

Time:12-22

I receive the following error in the middle of running npm install on the package.json file of an Angular 10 application:

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

I know that npm is installed because I started the install with the command npm install. So, I don't understand why the installation of NPM packages for the Angular application fails partway through with this message.

CodePudding user response:

The exact reason why this was happening is not certain, but it seems to have started when I updated the package jasmine-core from ~3.5.0 to ~3.10.0.

After I uninstalled Node.js and deleted all folders from previous Node.js installations and after I updated jasmine-core from ~3.5.0 to ~3.8.0 (instead of ~3.10.0), then I was able to run npm install again without errors.

CodePudding user response:

I'm not sure exactly what the issue is here, but you have three options which have a chance of working.

  • using npx npm install instead of npm install
  • reinstalling npm via npm i -g npm (this automatically picks the newest version)
  • reinstalling node (I put this one last because it's not worth it for slow internet connections and it's also a waste of time in general considering the above two should work fine)
  • Related