npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

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

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"