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 Build a REST API With Express Building API Routes in Express Create an Express App

Sara Broad
Sara Broad
1,917 Points

What is package-lock.json?

When I did npm init, I got a package-lock.json file. What is this file? Do I need it? I got this on another project I am working on but don't know if I need it. It doesn't appear in the file structure on the video. Thank you!

2 Answers

Sam Gord
Sam Gord
14,084 Points

practically package-lock.json file contains the information about the project like "version" and "dependencies" and info about plugins installed in the project via "npm i" command.

Sara Broad
Sara Broad
1,917 Points

Do I need to have it? Should I delete the file? I'm looking at past projects that I did in my boot camp and some of them don't have a package-lock.json. Thanks for your reply!

Sam Gord
Sam Gord
14,084 Points

well , do you need to keep it or not? the answer of this question depends on why you used the npm init command at first place? if u wanna use some sort of package manager or task runner or the project you're working on depends on it then i think u shouldn't remove it . and if the scenario is different then u can delete it but leaving it to be makes no harm i guess ;)