package-lock.json changes on npm install
Describe the bug
This is encountered by many developers. This is actually not a bug but this is happening due to the different versions of npm developers are using and when they try to npm install, the lockfileVersion changes from 1 to 2, and therefore package-lock.json also changes.
Reason
In the recent version of npm i.e v7, a new Lockfile Format has been introduced to increase the performance. Reference
To Reproduce
Steps to reproduce the behavior:
- Upgrade npm to the latest version
To upgrade on Linux:
sudo npm install -g npm@latestTo upgrade on Windows follow this link - Pull the latest commits on your local Git repo
-
npm install
Solution
Since the main repo is using lockfileVersion: 1 there could be two solutions:
-
Mentors can merge a PR containing
lockfileVersion: 2or upgrade the npm version by themselves and then runnpm install. As v2 is backward compatible this should not create bugs for developers using npm versions 5 or 6. See here -
As long as this issue is not solved, developers can run
npm ciinstead ofnpm installas it installs dependencies directly frompackage-lock.jsonsolockfileVersionwould not get changed.
Any suggestions @KeenWarrior @kunal-kushwaha @Abhishek-kumar09
Will the change would be backward compatible? And Do you want to work on this issue