Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between npm 3 vs Bower?

Tags:

node.js

bower

With npm 3 coming with a flat(-ish) dependency structure, do we use Bower in future or just npm 3 when its released ?

npm is most commonly used for managing Node.js modules, but it works for the front-end too when combined with Browserify and/or $ npm dedupe.

Bower is created solely for the front-end and is optimized with that in mind. The biggest difference is that npm does nested dependency tree (size heavy) while Bower requires a flat dependency tree (puts the burden of dependency resolution on the user)

merge bower into npm

npm3

npm-and-front-end-packaging

like image 552
Liam Avatar asked Aug 19 '15 05:08

Liam


People also ask

What is difference between NPM and Bower?

In Bower, only one version would be installed of a dependency shared by multiple other dependencies. In NPM, multiple versions of the same dependency would be installed, causing unnecessary bloat and thus slowing things down.

What is NPM Bower?

Bower offers a generic, unopinionated solution to the problem of front-end package management, while exposing the package dependency model via an API that can be consumed by a more opinionated build stack.

Does Bower use NPM?

Bower is a command line utility. Install it with npm. Bower requires node, npm and git.

What is Bower in node JS?

Bower is a front-end dependency tool to manage HTML, CSS, JS for our front-end packages. The most used for client-side dependencies are like jquery dependency management or other front-end package dependency management.


2 Answers

npm 3 coupled with browserify or webpack is the way to go now. Multiplying package manager in your project make your workflow harder.

Install npm 3 today with:

npm install -g npm@latest
like image 53
PowerKiKi Avatar answered Oct 13 '22 04:10

PowerKiKi


  • Bower is mainly for frontend libraries, which do not have dependencies of their own, thus in bower, flat structure is a limitation, rather than a feature.

  • npm-3 is a smart dependency manager where dependencies can have their own secondary dependencies (sub-dependencies).

  • It tries to create flattened structure wherever possible, but that is not a limitation. In certain cases, it will not adhere it (for example : when you need multiple version of a dependency)

like image 26
Sachin Avatar answered Oct 13 '22 06:10

Sachin