Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 7, 2026·3 min de lecture

Bower — The Original Front-End Package Manager

A package manager for the web that manages front-end dependencies using a flat dependency tree, keeping components organized and accessible.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Bower Overview
Commande d'installation directe
npx -y tokrepo@latest install 5cb6bd4b-7a00-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Bower was created by Twitter to solve front-end dependency management before npm and bundlers handled browser packages. It introduced the concept of a dedicated package registry for client-side libraries, serving as the standard way to install jQuery, Bootstrap, Angular, and thousands of other front-end components.

What Bower Does

  • Installs front-end packages (CSS, JavaScript, fonts) from its registry or Git repositories
  • Maintains a flat dependency tree to avoid duplicate library versions in the browser
  • Manages versions and semver ranges via bower.json manifest files
  • Resolves packages from the Bower registry, GitHub, or direct URLs
  • Installs components into a configurable bower_components directory

Architecture Overview

Bower operates as a Node.js CLI that reads bower.json for dependency declarations. It queries the Bower registry (a lookup service mapping package names to Git endpoints), clones the specified versions, and places them in a flat directory. Unlike npm's nested node_modules, Bower intentionally flattens the tree since browsers cannot deduplicate nested copies of the same library.

Self-Hosting & Configuration

  • Install via npm and create a bower.json with bower init
  • Configure install directory and registry URL in .bowerrc
  • Use bower link for local package development
  • Set up a private registry for internal packages using bower-registry
  • Integrate with build tools via wiredep to auto-inject dependencies into HTML

Key Features

  • Flat dependency tree designed for browser constraints
  • Dedicated registry with thousands of front-end packages
  • Support for installing from Git repos, GitHub shorthand, and URLs
  • Version conflict resolution with interactive prompts
  • Hookable through preinstall and postinstall scripts in .bowerrc

Comparison with Similar Tools

  • npm — Now handles front-end packages well with bundlers; nested dependency tree is no longer an issue with module bundlers
  • Yarn — Drop-in npm alternative with deterministic installs and workspaces; replaced Bower for most projects
  • pnpm — Disk-efficient package manager using hard links; modern alternative for all JavaScript dependencies
  • CDN (unpkg, jsdelivr) — Direct script tag inclusion; simpler but lacks version locking and offline support

FAQ

Q: Is Bower still maintained? A: Bower is in maintenance mode. The project recommends migrating to npm or Yarn combined with a bundler like webpack or Vite.

Q: Why was Bower necessary? A: Before module bundlers existed, npm's nested node_modules structure was unsuitable for front-end code. Bower's flat tree ensured only one copy of each library was loaded in the browser.

Q: How do I migrate from Bower to npm? A: Most Bower packages are also published on npm. Replace bower install commands with npm install, update import paths, and use a bundler to resolve modules.

Q: Can Bower install private packages? A: Yes. Bower can install from private Git repositories and supports private registries for organizations.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires