PhpStorm 2024.1 Help

Bower

Bower is a package manager for client-side libraries and components that contain HTML, CSS, JavaScript, fonts, image files, and so on. You can install, locate, upgrade, and remove Bower packages without leaving PhpStorm, on the dedicated Bower page or from the command line in the built-in terminal.

Before you start

  1. Download and install Node.js.

  2. Make sure a local Node.js interpreter is configured in your project: open the Settings dialog (Ctrl+Alt+S) and go to Languages & Frameworks | Node.js. The Node interpreter field shows the default project Node.js interpreter.

    Learn more from Configuring a local Node.js interpreter.

Installing and configuring Bower

Install Bower

  • In the embedded Terminal (Alt+F12) , type:

    npm install -g bower

Create bower.json

  1. In the embedded Terminal (Alt+F12) , type:

    cd <your project folder> bower init
  2. Answer the questions to specify the following basic settings:

    • The testing framework to use.

    • The browsers to be captured automatically.

    • The patterns that define the location of test files to be involved in testing or excluded from it.

    Learn more from the Bower official website.

Configure Bower in PhpStorm

  1. Press Ctrl+Alt+S to open settings and then select Languages & Frameworks | JavaScript | Bower.

  2. Specify the location of the Bower package and the bower.json configuration file.

Managing Bower packages

Bower installs packages only as project dependencies or development dependencies, learn more from the Bower official website. You can manage Bower packages on the Bower page or in the Terminal tool window.

  • In the embedded Terminal (Alt+F12) , type one of the following commands:

    • bower install --save <package_name> to install the package as a project dependency.

    • bower install --save-dev <package_name> to install the package as a development dependency.

  • Press Ctrl+Alt+S to open settings and then select Languages & Frameworks | JavaScript | Bower.

    On the Bower page, the Packages area shows all the Bower packages that are currently installed in your project.

    • To install a package, click the Add button, and in the Available Packages dialog that opens, select the required package and click Install Package.

    • To upgrade to the latest version of a package, select it in the list and click the Upgrade button (the Upgrade button).

    • To uninstall a package, select it in the list and click the Remove button (the Remove button).

Last modified: 09 July 2024