Category - Tutorials
Package Mangers Nuget vs NPM vs Bower
Package Managers - Nuget vs NPM vs Bower
There are a lot of different package managers out there. Typically, a manager for each framework! As a .Net developer, these are the most common three you will come across.
Technically, they all have 3 separate roles and it's really not a one or the other! However, the lines definitely get blurry as is apt to occur when you allow user submitted packages. To often as developers we try to make one tool work for everything. When what we really should be doing is using the strongest tool for each job.
Let's examine their strengths and primary uses:
- Nuget - www.nuget.org
Pro - This is the .Net framework means of delivering software packages to use in your application. It's largest benefit comes from the packaged .dlls that you can download and include. These downloadable packages can rapidly speed up production and save you a LOT of headache. Some of my favorites are: ImageResizer (dynamically resize images on upload), and NPOI (to parse data to excel files).
- NPM (Node Package Manager) - www.npmjs.com
Con - Just like nuget, developers have tried to make this a be all solve all and use it for client side files as well. This ends up creating a mess of server and client side files in the same spot as it suffers from the age old problem of put it all in one place (default is the node_modules folder).
- Bower - Bower.io
Pro - This package manager is actually installed through NPM as it runs on top of node. It's primary role is to manager client side files. It is probably the only package manager that hasn't gotten too muddy, but that's likely because you have to go through NPM to get here. With the ability to pull from github or even a url, you have an immense ability to keep up to date or get the latest bug fix with supreme ease. Some of my favorites are: Angular and Bootstrap.
Con - The only real con with bower is that it suffers from the same problem as other package managers by putting all of the retrieved files into one folder (default is the bower_components). This is just a fact of life with package managers.
Best tool for the job
Now that we have dicussed the pros and cons of each, let's talk about what you as a full stack .net developer should use each one for.
- Nuget - Any .net dlls that your project needs like Entity Framework or ASP.Net Identity.
- NPM - Any node packages your project needs like Grunt or GruntSass.
- Bower - Any client side packages your project needs like jQuery or Angular.
You don't typically have a need or reason to change nuget's repository directory when used in this way. You can change NPM's or Bower's or even write some code in a grunt task to run npm install and bower install and then shuffle the files to where you want.
Visual Studio 2015 supports npm, bower and event grunt. You can get many extensions to also give you similar support for older versions of Visual Studio.
Overall, be a developer that uses the best tool for the job and creates the most efficient product possible.
You must be logged in to comment.