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 Building a MEAN Application Setting Up MongoDB Using MongoDB with Express and Mongoose

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

hi,

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.

best,

ā€” faddah portland, oregon, u.s.a.

2 Answers

Dave McFarland
STAFF
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.

best,

ā€” faddah

 portland, oregon, u.s.a.