Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNicholas Smay
14,768 Pointspackage-lock.json created when updating packages
Anyone know why this file would be created each time I run npm update? Also, I noticed this file is created whenever I run "npm install [filename] --save"
Thanks for your help!
1 Answer
miikis
44,957 PointsHey Nicholas,
The purpose of that lock-file is to protect your dependencies from change. In that sense, it's like package.json but more robust in its documentation of your dependencies. You can still consider your package.json as your source-of-truth, however, since the contents of package.json will override the lock-file. By default, npm (v5+) will create a lock-file every time you run npm install
.
Read more here: npm docs Medium article
Nicholas Smay
14,768 PointsNicholas Smay
14,768 PointsMuch appreciated! That makes sense. I'll take a look at those articles.
Cheers!