package-lock.json is rewritten after npm install

Viewed 2057

I was working on a react project.
I cloned it in a new machine.
As soon as I ran the command npm install, package-lock.json file was rewritten completely.

  • Is this a problem?
  • And how should I deal with it?
1 Answers

npm install can rewrite package-lock.json file. Probably you have dependencies with not fixed version '~x.x.x' or '^x.x.x'. If you already have package-lock.json and want install packages without update lock file, you can use npm ci. See this doc

Related