1

I have a workspace on c9.io, and I am using node.js. I am trying to update socket.io from 0.9.17 to the latest version. However, whenever I run the command npm update socket.io it installs the same version. How can I fix this?

Dorian Dore
  • 942
  • 4
  • 15
  • 35

1 Answers1

1

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

Community
  • 1
  • 1
Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129