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?

1
  • ^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 npmjs.com/package/semver and the examples in semver.npmjs.com Commented Mar 12, 2019 at 16:33

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.