Search code examples
javascriptnode.jsnpm

Why doesn't npm update install the latest nodemon version?


When I install nodemon using:

npm i nodemon

I get of course always the last version which in this case is: 2.0.2,

but if I install an older version for example:

npm i [email protected]

and after that I try npm update, I get the 1.19.4 version but not the last one 2.0.2 just like when I execute npm install nodemon.

Why npm update is not updating in this case to 2.0.2 ?


Solution

  • It depends on the version of npm, but npm update don’t get a newer, major version of the package if it breaks one or more dependecies. In fact, you’re stuck on version 1.x. You can easily use npm i foo to get the very latest version instead with warnings. See https://docs.npmjs.com/cli-commands/update.html for more details, based on the npm version you’re using (and how to get the previous behaviour).