Brian Bolton
Brian Bolton

Reputation: 3642

How do I install bower using package.json and npm install?

How do I install bower using package.json and npm?

I have my package.json file setup like so..

{
    "name": "myprogramname",
    "version": "0.0.1",
    "devDependencies": {
        "bower": "1.2.6"
        //other dependencies are listed as well
    }
}

from the command line I run

npm install

It installs all of my dependencies in devDependencies except bower. Any reason for this?

Also,

which bower

returns nothing

Upvotes: 17

Views: 23695

Answers (3)

vinyll
vinyll

Reputation: 11439

You installed locally and that's a good idea as you won't impact your other projects Bower versions.

You can now run bower with the local node executer:

npx bower

Upvotes: 0

kiml42
kiml42

Reputation: 660

A neater way to use a local install of bower is shown here.

Basically you need to use "npm run bower install" instead of "bower install" if you install bower through NPM locally and don't have it installed globally on your computer.

Upvotes: 1

Aurélien Thieriot
Aurélien Thieriot

Reputation: 5923

Npm did actually install Bower but not globally. If you check your node_modules/ directory, it should be there.

Therefore, it IS accessible for other developers at this path:

node_modules/bower/bin/bower

Upvotes: 18

Related Questions