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 trialJavier Alvarado
16,060 PointsWhat is the difference between Github and npm?
More specifically, why would I use npm to find and share code over Github? I feel like there is a little bit of overlap in what each one does although I could be mistaken.
1 Answer
Nattapol Kamolbal
15,528 PointsGithub is an online version control service. You store your files there and share them to world. On the process, you can track your file changes. You can revert back if it look bad in the last change. Other people can see your files and may working at it too.
Npm help you manage your project's code library package. You can tell it to install this and that packages. You can see if the packages have new version or not, and you can choose to update it.
For some real life example:
First, you saw other people framework compelling and want to use it to start your project. You saw that they've shared it on Github so you cloned it to your pc and started working with it.
Then you realized that you want to use the package call gulp to help with your job. You use npm to install gulp package in your project.
After that you wrote a lot of code and satisfied to call it a new version so you commit your change to Github (in other word, you stored a new version to your Github.)
Two days later, your friend told you that your code have some bugs and helped you to fixed it. He then made a pull request for you. You accepted the bug-fixed request and it is then your new version on Github.
A week later, gulp released a new update. You saw that it's look better so you use npm to update your gulp package.