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 Managing Packages with NPM Updating, Uninstalling and Executing Packages

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

not including packages in Github

I have a dumb question, that how do we preview a website, if we do not include the packages or modules added for building the website, for Ex- do we include the source and included packages on the server or we do not, then why don't we include it in the GitHub repo,why do we put the node_modules inside .gitignore. If we donot include the Packages, then how do our Webpage use the features of the library/framework/packages

1 Answer

Charlie Palmer
Charlie Palmer
15,445 Points

Hi, .gitignore those packages inside of the node modules since they are already online for everyone to install if they're needed. The package.json and the package-lock.json are going to store all of the project dependencies. Because of this, anyone who pulls the project can just run the command "npm install" and this will install the dependencies which they need in order to run the project and for this reason we do not upload the packages. I do believe that if you're using this then you won't be able to host the page on git hub pages if this is what you mean by preview.