What is the bower (and npm) version syntax?

Bower enables me to specify version requirements for packages using the following syntax:

"dependencies": {
  "<name>": "<version>",
},

But I have not been able to find what is the syntax to use for the <version>. I know that I can specify versions to be:

  • greater than a certain version with ">1.0.0"
  • greater than or equal to a version: ">=1.0.0"
  • or in some range: "1.0.0 - 2.0.0".

I also know that there is a common version syntax containing the tilde: "~1.0.0". But I am not sure what it means and whether it is the same as "=1.0.0".

I am also interested to know whether I am able to specify multiple non-consecutive versions, such as exactly 1.0.3 plus versions greater than 1.5.0, etc…

5 Answers
5

Leave a Comment