DEV Community

Discussion on: package.json vs package-lock.json: do you need both?

Collapse
 
saisandeepvaddi profile image
Sai Sandeep Vaddi

I always want to keep .lock files.

Sometimes it's a nightmare to update node packages when the project doesn't have .lock file especially when there are no thorough tests.

One time we had an old project which I picked up couple of months later and no lock file. I ran yarn install which apparently installed latest minor version. There were no errors. But, scroll of a virtual list doesn't work. There were no tests to see how many pixels it scrolls on mouse scroll and whether it shows flickering. I tried all the options from the different libraries' docs and checked their git repo issues to see if any of them have anything to do with it. No help. After days of headache, when I installed the version that had released around the time the project was last touched, it magically worked. Lesson learned.