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 npm Basics (retiring) Installing Packages with npm Installing Global Packages

Adam Lyles Kauffman
Adam Lyles Kauffman
13,856 Points

difference between global and package installed last video

having problems seeing what the -g flag specifically does. last video i didnt install bcrypt with my project files (and i didnt use the -g flag), but bcrypt still worked in the javascript file. how is a global package/module different?

1 Answer

Clayton Perszyk
Clayton Perszyk
Treehouse Moderator 48,723 Points

If you’re installing something that you want to use in your program, install it locally, at the root of your project (--save).

If you’re installing something that you want to use in your shell, on the command line, install it globally, so that its binaries end up in your PATH environment variable.