LinuxCommandLibrary

bower

Manage front-end web dependencies

TLDR

Install a project's dependencies, listed in its bower.json

$ bower install
copy

Install one or more packages to the bower_components directory
$ bower install [package] [package]
copy

Uninstall packages locally from the bower_components directory
$ bower uninstall [package] [package]
copy

List local packages and possible updates
$ bower list
copy

Create a bower.json file for your package
$ bower init
copy

Install a specific dependency version, and add it to bower.json
$ bower install [local_name]=[package]#[version] --save
copy

Display help for a specific command
$ bower help [command]
copy

SYNOPSIS

bower <command> [<options>]

PARAMETERS

-h, --help
    Display help for command

-v, --version
    Output Bower version

-q, --quiet
    Suppress status messages

--verbose or -V
    Enable verbose logging

--allow-root
    Run as root user (insecure)

--config.key=value
    Set config like registry or directory

--force
    Force latest version on update

--production
    Skip dev dependencies

--save
    Add to bower.json dependencies

--save-dev
    Add to bower.json devDependencies

--save-exact
    Save exact version, no ^/~

DESCRIPTION

Bower is a command-line package manager optimized for front-end web development. It enables developers to discover, install, update, and remove client-side libraries such as JavaScript frameworks (e.g., jQuery, React), CSS frameworks (e.g., Bootstrap), and other assets like fonts or images.

Dependencies are declared in a bower.json manifest file, akin to package.json in Node.js projects. Bower resolves dependencies using semantic versioning, fetches packages from registries, Git repos, or URLs, and installs them into a flat bower_components directory to minimize duplication and simplify inclusion via script/link tags.

Key benefits include offline caching, production/dev dependency separation, and easy sharing via bower.json. However, Bower emphasizes a non-nested structure, which contrasts with npm's tree.

Important: Bower is officially deprecated since 2017. Its maintainers advise switching to npm, Yarn, or pnpm combined with bundlers like Webpack or Rollup for superior performance, deduplication, and modern ES modules support.

CAVEATS

Deprecated since 2017; unmaintained. Migrate to npm/Yarn + bundlers for new projects. May fail with modern Git/Node versions.

INSTALLATION

Requires Node.js/npm: npm install -g bower
Verify: bower -v

COMMON WORKFLOW

bower init (create bower.json)
bower install bootstrap --save
bower list (check updates)
bower update

REGISTRY

Default: Bower registry at registry.bower.io. Search: bower search angular

HISTORY

Developed by Twitter in November 2012 (v0.1.0). Hit v1.0 in Feb 2013. Widely adopted for front-end deps until npm improvements. Deprecated Nov 28, 2017, as bundlers made it obsolete.

SEE ALSO

npm(1), yarn(1), pnpm(7)

Copied to clipboard