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

When a package.json file is included in your project, does npm install dependencies for that package automatically?

.

1 Answer

Darryl Mah
Darryl Mah
5,492 Points

Typically the “node_modules” folder containing all the dependencies will not be included in a project file you download. This because they can often carry large amounts of data. The package.json file will include names of the dependence’s but not the actual files. When you run npm install on the project this will trigger npm to look at the dependencies listed in the package.json file and download the the actual codes for these dependencies into the node_modules folder. This prevents you from having to look into that file and installing them all individually.