3 ms·
Let's say you have two dependencies each requesting colors: colors@1.0.1-1.0.3 colors@1.0.1-1.0.4 With npm, you'll end up with 1.0.3 because it satisfies all
by howdydoo 5y ago
Let's say you have two dependencies each requesting colors:
colors@1.0.1-1.0.3
colors@1.0.1-1.0.4
With npm, you'll end up with 1.0.3 because it satisfies all constraints. OP wants to end up with 1.0.4 if at least one dependency tested with 1.0.4 (and reject 1.0.5). I don't know of a way to do this with npm today.
- gitgud 5y agoYou might like the [1] "overrides" field in npm v8.3 although I would recommend using it with caution, changing your dependencies dependencies has unknown consequences... even a patch release can break everything... [1] https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides https://docs.npmjs.com/cli/v8/configuring-npm/package-json#o...
- remram 5y agoYou are reading this wrong. The OP is suggesting that if you have two dependencies that are requesting: colors@^1.0.1 colors@^1.0.2 then npm should get you 1.0.2, instead of 1.0.4, because it's the "version as close as possible" to "the dependency version that the package was actually tested with". OP is not suggesting that npm should ignore dependency constraints, just that the version that is picked is the closest to the tested version (among those that satisfy the constraints). If you have a package that explicitly says it won't work with >1.0.3, installing 1.0.4 is silly.