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

Adam Lyles Kauffman
Adam Lyles Kauffman
12,899 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
MOD
Clayton Perszyk
Treehouse Moderator 46,860 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.