a.khakh
a.khakh

Reputation: 145

How to prevent `package.json` beign rewritten by `npm update`

Let's say I have a dependency in my package.json:

  "dependencies": {
    "my-dependency": "~1.0.0"
  }

And there's 1.0.1 version of the package available. When I run npm update my-dependency it changes the version in package-lock.json file to 1.0.1 (which is completely fine) and it changes the dependency in package.json to

  "dependencies": {
    "my-dependency": "^1.0.1"
  }

Why? How to prevent it? I only wanted to change my package-lock.json file, I didn't want to change ~ to ^.

Upvotes: 1

Views: 405

Answers (0)

Related Questions