Installing and Removing Bower Packages
Bower packages can be installed and used only in a specific project. PhpStorm supports two installation modes: from the command line and through the dedicated user interface.
On this page:
- Installing a Bower Package in the Command-Line Mode
- Installing a Bower Package through the PhpStorm Interface
- Removing Bower Packages
- Installing a Bower Package as a Development Dependency
Installing a Bower Package in the Command-Line Mode
-
Launch the embedded Terminal
by hovering your mouse pointer over
in the lower left corner of PhpStorm and choosing Terminal from the menu (see Working with Embedded Local Terminal for details).
-
Switch to the directory where Bower is stored or define a
PATH
variable for it so it is available from any folder, see Installing Bower. -
Type the following command at the command line prompt:
bower install <tool name>
Installing a Bower Package through the PhpStorm Interface
-
Run Bower from PhpStorm using the Bower page of the Settings dialog box.
- Open the Settings / Preferences Dialog by choosing for Windows and Linux or for OS X. Expand the Languages&Frameworks node, and then click Bower under JavaScript.
-
On the Bower page that opens, the Packages area shows all the Bower-dependent packages
that are currently installed on your computer, both at the global and at the project level.
Click
.
- In the Available Packages dialog box that opens, select the required package.
- Optionally specify the product version and click Install Package to start installation.
Removing Bower Packages
Open the Bower page, select the package to remove, and click
Installing a Bower Package as a Development Dependency
If a Bower package is a documentation or a test framework, which are of no need for those who are going to re-use your application,
it is helpful to have it excluded from download for the future. This is done by marking the tool as a development dependency,
which actually means adding the Bower package in the devDependencies
section of the package.json
file.
With PhpStorm, you can have a Bower package marked as a development dependency right during installation. Do one of the following:
-
Run the installation from the command line in the global mode:
-
Launch the embedded Terminal
by hovering your mouse pointer over
in the lower left corner of PhpStorm and choosing Terminal from the menu (see Working with Embedded Local Terminal for details).
-
Switch to the directory where Bower is stored or define a
PATH
variable for it so it is available from any folder, see Installing Bower. -
Type the following command at the command line prompt:
bower install -dev <tool name>
-
Launch the embedded Terminal
by hovering your mouse pointer over
- Install the package using the PhpStorm user interface:
- Open the Settings / Preferences Dialog by choosing for Windows and Linux or for OS X. Expand the Languages&Frameworks node, and then click Bower under JavaScript.
-
On the Bower page that opens, the Packages area shows all the Bower-dependent packages
that are currently installed on your computer, both at the global and at the project level.
Click
.
- In the Available Packages dialog box that opens, select the required package.
-
Select the Options check box and type
--dev
in the text box next to it. - Optionally specify the product version and click Install Package to start installation.
After installation, a Bower package is added to the devDependencies
section of the package.json
file.