npm install keeps rewriting the package-lock.json file. Why does it keep doing that?

Asked 2 years ago

Every time I run the npm install command, the package-lock.json removes many of the dependencies I've already installed. However, if I delete the node_modules and run the command again, the installation proceeds as expected. What's the problem?

Kasey Ware

Saturday, October 08, 2022

This is expected behaviour from npm, and it isn't a bug. Every time you run the npm install command, a new package-lock.json file gets created. A quick fix would be using npm ci instead of npm install (if your goal is installing from the package-lock.json file).

Write an answer...


Please follow our  Community Guidelines

Can't find what you're looking for?