Question: What is the fundamental difference between `bower` and `npm`? Just want something plain and simple. I've seen some of my colleagues use `bower` and `npm` interchangeably in their projects.

Answer: 
This answer is an addition to the answer of Sindre Sorhus. The major difference between npm and Bower is the way they treat recursive dependencies. Note that they can be used together in a single project.

**On the [npm FAQ](https://web.archive.org/web/20150906022540/https://docs.npmjs.com/misc/faq#why-can-t-npm-just-put-everything-in-one-place-like-other-package-managers):** (archive.org link from 6 Sep 2015) 

> 
> It is much harder to avoid dependency conflicts without nesting
>  dependencies. This is fundamental to the way that npm works, and has
>  proven to be an extremely successful approach.
> 
> 
> 

**On [Bower](http://bower.io/) homepage:**

> 
> Bower is optimized for the front-end. Bower uses a flat dependency
>  tree, requiring only one version for each package, reducing page load
>  to a minimum.
> 
> 
> 

In short, npm aims for stability. Bower aims for minimal resource load. If you draw out the dependency structure, you will see this:

npm:

```
project root
[node_modules] // default directory for dependencies
 -> dependency A
 -> dependency B
    [node_modules]
    -> dependency A

 -> dependency C
    [node_modules]
    -> dependency B
      [node_modules]
       -> dependency A 
    -> dependency D

```

As you can see it installs some dependencies recursively. Dependency A has three installed instances!

Bower:

```
project root
[bower_components] // default directory for dependencies
 -> dependency A
 -> dependency B // needs A
 -> dependency C // needs B and D
 -> dependency D

```

Here you see that all unique dependencies are on the same level. 

**So, why bother using npm?**

Maybe dependency B requires a different version of dependency A than dependency C. npm installs both versions of this dependency so it will work anyway, but Bower will give you a *conflict* because it does not like duplication (because loading the same resource on a webpage is very inefficient and costly, also it can give some serious errors). You will have to manually pick which version you want to install. This can have the effect that one of the dependencies will break, but that is something that you will need to fix anyway.

So, the common usage is Bower for the packages that you want to publish on your webpages (e.g. *runtime*, where you avoid duplication), and use npm for other stuff, like testing, building, optimizing, checking, etc. (e.g. *development time*, where duplication is of less concern).

**Update for npm 3:**

npm 3 still does things differently compared to Bower. It will install the dependencies globally, but only for the first version it encounters. The other versions are installed in the tree (the parent module, then node\_modules).

* [node\_modules]
	+ dep A v1.0
	+ dep B v1.0
		- ~~dep A v1.0~~ (uses root version)
	+ dep C v1.0
		- dep A v2.0 (this version is different from the root version, so it will be an nested installation)

For more information, I suggest reading the [docs of npm 3](https://docs.npmjs.com/how-npm-works/npm3-dupe)
2017-Oct update
---------------

Bower has finally been [deprecated](https://bower.io/blog/2017/how-to-migrate-away-from-bower/). End of story.

Older answer
------------

[From Mattias Petter Johansson, JavaScript developer at Spotify](https://www.quora.com/Why-use-Bower-when-there-is-npm/answer/Mattias-Petter-Johansson):

> 
> In almost all cases, it's more appropriate to use Browserify and npm over Bower. It is simply a better packaging solution for front-end apps than Bower is. At Spotify, we use npm to package entire web modules (html, css, js) and it works very well.
> 
> 
> Bower brands itself as the package manager for the web. It would be awesome if this was true - a package manager that made my life better as a front-end developer would be awesome. The problem is that Bower offers no specialized tooling for the purpose. It offers NO tooling that I know of that npm doesn't, and especially none that is specifically useful for front-end developers. **There is simply no benefit for a front-end developer to use Bower over npm.**
> 
> 
> We should stop using bower and consolidate around npm. Thankfully, that is what [is happening](http://www.modulecounts.com/):
> 
> 
> 

[![Module counts - bower vs. npm](https://i.stack.imgur.com/HLBsP.png)](https://i.stack.imgur.com/HLBsP.png)

> 
> With browserify or webpack, it becomes super-easy to concatenate all your modules into big minified files, which is awesome for performance, especially for mobile devices. Not so with Bower, which will require significantly more labor to get the same effect.
> 
> 
> npm also offers you the ability to use multiple versions of modules simultaneously. If you have not done much application development, this might initially strike you as a bad thing, but once you've gone through a few bouts of [Dependency hell](http://en.wikipedia.org/wiki/Dependency_hell) you will realize that having the ability to have multiple versions of one module is a pretty darn great feature. Note that npm includes a very handy [dedupe tool](https://docs.npmjs.com/cli/dedupe) that automatically makes sure that you only use two versions of a module if you actually *have* to - if two modules both *can* use the same version of one module, they will. But if they *can't*, you have a very handy out.
> 
> 
> 

(Note that [Webpack](https://www.reddit.com/r/javascript/comments/2is81v/why_is_not_systemjs_dominating_the_field_of/cla66t3) and [rollup](https://nolanlawson.com/2016/08/15/the-cost-of-small-modules/) are widely regarded to be better than Browserify as of Aug 2016.)