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 trial

JavaScript Angular Basics Setting Up an Angular Application Your First Angular Application

package-lock.json

Why does the package keep downloading this package-lock.json file? It doesn't show this file in Andrew's folder structer.

2 Answers

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,696 Points

The package-lock.json was first introduced in npm 5. Per the docs:

This file describes an exact, and more importantly reproducible node_modules tree. Once it's present, any future installation will base its work off this file, instead of recalculating dependency versions off package.json.

I can safely deduce this course was recorded before npm 5 was released. Thus, package-lock.json hadn't existed yet.

Greg Schudel
Greg Schudel
4,090 Points

So lemme get this straight...we DONT need package.json now? All we need is package.lock? I have package-lock.json in my editor (i'm using Sublime Text), will that suffice?

Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,696 Points

You absolutely need package.json. The package-lock.json is optional and is generated based on the package.json dependencies.

Don't worry about this file, it is only added because your version of NPM is more recent than when this was recorded :)