Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Building a MEAN Application Setting Up MongoDB Using MongoDB with Express and Mongoose

Why install npm packages as "--save-exact"?


i was wondering why Huston Hedinger & Ken Howard suggest making all the local installs of npm packages in this course, particularly mongoose, the node mongodb driver, with the --save-exact or --save-dev-exact flag? isn't it better to just save in the regular way, so if these packages ever update, our app will still work with them?

please advise. i don't see any advantage to saving for exact versions, as these packages are always constantly updating.


— faddah portland, oregon, u.s.a.

2 Answers

Dave McFarland
Dave McFarland
Treehouse Teacher

Faddah Wolf If you're building out a production app, you don't always want to let your dependencies automatically update -- even if you've only specified a PATCH update, with hundreds of inter-working packages there is a possibility that an untested update could blow up your app. In development and when messing around with an app, you're probably safe allowing PATCH or MINOR updates. I believe Huston and Ken are modeling a real-world scenario where you are building out an app that's going into production and you KNOW that the modules and all their dependencies work at the current (EXACT version) they are at now.

In addition, using --save-exact makes sure that if you are following along the tutorial will always work.

hi Dave McFarland,

thank you for your response — ok, i think i understand a bit better now. i will mark yours as best answer and close this out.


— faddah

 portland, oregon, u.s.a.