0

Using semver as the standard, so I have this package version:

0.0.108

so in package.json for a Node.js project, I might have something like:

"foo":"^0.0.108"

my question is - using semver notation, how can I tell NPM not to install anything below 0.0.108? For example, 0.0.107 is unacceptable, but 0.0.109, or 0.0.111 is ok?

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
  • `^0.0.108` *is* how you tell NPM not to install anything below 0.0.108. If you want the patch to be allowed to change, then it'd be `~` rather than `^`, as `108` is the *"leftmost non-zero digit"*. See the explanations in https://www.npmjs.com/package/semver and the examples in https://semver.npmjs.com/ – jonrsharpe Mar 12 '19 at 16:33

1 Answers1

1

If you don't want anything in 0.1.x, then this should work

>=0.0.108 <0.1

If you are okay with any future versions, such as major releases, then you only need

>=0.0.108

Note the semver spec (Section 4) and the npm documentation on semver (Caret Ranges) both suggest there can be breaking changes for every release when the minor version number is still 0, so you may have to deal with those if you decide not to use ^0.0.108.

Half
  • 5,078
  • 2
  • 10
  • 20