Bower and NPM Confusion


#1

There is frequent confusion among the two. I understand that it is advised to use NPM going forward.

However, I would still like to understand the following:

How do Bower dependencies not conflict with NPM dependencies if they are the same? Do they use different namespaces? Can an NPM library ever rely on a Bower library?

Thanks for any help!


#2

I think you will never use the same module as bower and NPM but because they are in different folders there still has to be no conflict. Ember NPM addons use addBowerPackagesToProject to rely on a Bower library:

https://github.com/nolanlawson/ember-pouch/blob/master/blueprints/ember-pouch/index.js#L6


#3

Historically Bower was aimed at browser-specific libraries, so all the libraries installed that way would be available via global variables. NPM modules on the other hand are designed to be imported as needed in the specific files. Hence a lack of collisions (although it would be possible if you tried hard enough :wink: )