Differences between bower and npm

Source: Internet
Author: User

Simply put, npm is a module installation tool used for backend development, while bower is a front-end module installation tool.
For example, npm is used when installing express and socket. io, so front-end frameworks such as bootstrap and jquery need to use bower.

Front-end technologies and engineering practices have been advancing by leaps and bounds. I was wondering how many things I could use when I was using the semi-amateur front-end technical solutions for making pages, I can't understand it any more. This article focuses on the differences between the bower and npm of the same package manager.
It is mainly in stackoverflow's view that translation should be added to some of its own understandings.

Npm is accompanied by Node. A package manager in js can only support Node at the beginning. js module management, but after a revision of the npm official website, the slogan is javascript package manager, so it is no longer limited
The module management of Node. js has been applied to all js package management tools. It can be said that it is used both before and after.

From the very beginning, bower is the package manager designed specifically for front-end performance. Everything is considered by the front-end. The biggest difference between npm and bower is that npm supports nested dependency management, while bower can only support flat dependency (nested dependency
).

Nested dependency refers to the software package you depend on and its own dependencies. It seems like a bunch of grapes are picked. In the server environment, this does not matter, because the storage space is large enough, and all code is run locally, as long as the dependency is solved,
But in the browser of the user's product, it is quite a problem. It is too bad if you cannot let the user download several MB of js code. In this case, the programmer needs to manually solve the nested dependency problem of the class library used. For example, to ensure a variety of plug-ins
All depend on the same version of jQuery.

Why do many projects bower and npm use it, because bower is used to manage front-end packages, while npm is used to manage some back-end packages and build tools, such as yeoman, grunt, gulp, jshint and so on.

All package managers have their own drawbacks. You need to select the most appropriate option for your project as needed.

What is the relationship and difference between NPM and the package manager named Bower launched by Twitter? (Bower's official website says Bower is "A package manager for the web". It's hard to say NPM is not enough ).

In fact, NPM and Bower will be used in actual projects. The installation and upgrade of Bower depend on NPM. You can use the following command to install Bower globally.

Npm install-g bower
Then you can use

Bower install [#]
Similar to NPM, you can manage the front-end dependencies of the current project. It is as convenient and convenient to use as NPM.

The biggest difference between NPM and NPM is that NPM is mainly used for the internal dependency package management of the Node. js Project. The installed module is located in the node_modules folder under the root directory of the project. In most cases, Bower is used for front-end development. It manages the dependencies of CSS, JS, templates, and other content. The dependent download directory structure can be customized.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.