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 Managing Dependencies in the package.json File

Carrie Happoldt
Carrie Happoldt
15,160 Points

Why does "npm install" install all of the npm files, even ones I haven't specified

when I use the command "npm install --python=python2", my new node_modules folder has 30 to 40 other folders in it. The same thing happens, even if I use "NODE_ENV=production npm install". I know that all I should see is the bcrypt and colors packages. Anyone know what command I missed early on to have this happen? OR Is this how is should be with different versions? Thanks

1 Answer

Shawn Rieger
Shawn Rieger
9,916 Points

bcrypt and colors have dependencies of their own. The packages they depend on must be installed as well in order for them to work properly. Don't worry so much about what npm does with the node_modules folder, best to let npm worry about that :)

This changed in the NPM 3.0.0 release. If you prefer the legacy bundling you can use the following:

npm install --legacy-bundling