Dorian Dore Dorian Dore - 2 months ago 10x
Node.js Question - npm installs outdated packages

I have a workspace on, and I am using node.js. I am trying to update from 0.9.17 to the latest version. However, whenever I run the command

npm update
it installs the same version. How can I fix this?


To install the latest available package:

npm install <package>

To install a version directly (no need to uninstall first):

npm install <package>@<version>

If you're not sure what versions of a package are available, you can use:

npm view <package> versions

Don't forget the --save flag to add dependencies to your package.json file.

Source: How do I install a previous version of an npm package?

About npm update

However, if app's package.json contains:

"dependencies": {   
   "dep1": "~1.1.1" 

In this case, running npm update will install dep1@1.1.2. 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.

Source: npm update - Tilde Dependencies