Reputation: 331
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 ?
Upvotes: 1
Views: 5349
Reputation: 21
I think you installed nodemon globally, but you can updated it locally
by trying npm i -g nodemon
Upvotes: 2
Reputation: 128
It depends on your package.json entries for nodemon.
For example if a module has following dependencies:
{
"dist-tags": { "latest": "1.2.2" },
"versions": [
"1.2.2",
"1.2.1",
"1.2.0",
"1.1.2",
"1.1.1",
"1.0.0",
"0.4.1",
"0.4.0",
"0.2.0"
]
}
And you speicify '^' in package.json file:
"dependencies": {
"module": "^1.1.1" //npm update will install [email protected], because 1.2.2 is latest and 1.2.2 satisfies ^1.1.1
}
Or If your version is specified using '~' tas follows:
"dependencies": {
"module": "~1.1.1" // npm update will install [email protected]. Even though the latest tag points to 1.2.2, this version does not satisfy ~1.1.1, which is equivalent to >=1.1.1 <1.2.0. So the highest-sorting version that satisfies ~1.1.1 is used, which is 1.1.2
}
For more understanding you can follow this documentation: https://docs.npmjs.com/cli-commands/update.html
Upvotes: 1
Reputation: 584
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).
Upvotes: 1