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 trialEwerton Luna
Full Stack JavaScript Techdegree Graduate 24,031 PointsShould I have a node_modules folder inside each project folder or have only one placed outside it?
I mean, should I have a central node_modules folder and install all my packages inside it so, for each project, I would be accessing the packages from this unique folder? Or is it better to have a node_modules for each project folder I create?
1 Answer
Michael Hulet
47,913 Pointsnode_modules
is the directory that npm
/yarn
install the libraries that your project depends on, so it should be project-specific. Ultimately, you can add it to your .gitignore
and never think about it again. When you run npm install
/yarn add
, it will automatically add the dependency to your package.json
for your project and install it in your project's node_modules
folder
Ewerton Luna
Full Stack JavaScript Techdegree Graduate 24,031 PointsEwerton Luna
Full Stack JavaScript Techdegree Graduate 24,031 PointsThank you very much, Michael!