npm install --save <package>@<semver-range> stores different semver-range in package.json

(Punleuk Oum) #1

Our output is as expected when we perform: npm install --save hwrld@"<1.0.1"

+ hwrld@1.0.0
updated 1 package and audited 17 packages in 2.179s
found 0 vulnerabilities

However the saved result in the package.json is inconsistent:

"dependencies": {
  "hwrld": "^1.0.0"

We get exactly what we expect when we install an exact version: npm install --save hwrld@1.0.0

"dependencies": {
  "hwrld": "1.0.0"

So why the difference?

The expected result for the command npm install --save hwrld@"<1.0.1" should be

"dependencies": {
  "hwrld": "<1.0.1"

(system) #2

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.