Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

npm

bower

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

like image 453
Brian Bolton Avatar asked Feb 19 '14 19:02

Brian Bolton


2 Answers

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
like image 133
Aurélien Thieriot Avatar answered Oct 15 '22 15:10

Aurélien Thieriot


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.

like image 26
kiml42 Avatar answered Oct 15 '22 17:10

kiml42