Bower is for client side Javascript what npm is for the server side and reads a component.json
file to recognize dependencies that should be fetched at deploy time so I'd be happy it heroku would run it at slug compilation time.
Unfortunately I can not invoke npm or bower from a heroku console or one-off command (heroku run "npm help"
) (heroku run bash
-> npm help
) as it's possible with ruby's rake. I've put npm and node (latest/x versions) in my package.json
but in the engines section, not the dependencies.
I think this could be solved by customizing the node buildpack but I consider this a little too heavy task just for activating something so obvious.
Run the npm install command in your local app directory to install the dependencies that you declared in your package. json file. Start your app locally using the heroku local command, which is installed as part of the Heroku CLI. Your app should now be running on http://localhost:5000/.
Bower is a command line utility. Install it with npm. Bower requires node, npm and git.
Bower is a package manager, like npm, which manages frameworks, libraries, assets, and utilities, installs them, and makes sure they are up to date. Traditionally, many web development projects combined npm and Bower. npm was used to manage back-end dependencies, while Bower was used for front-end dependencies.
You can also setup a postintall
command, something like this in your package.json
"dependencies": { "bower": "0.6.x" }, "scripts": { "postinstall": "./node_modules/bower/bin/bower install" }
Then npm install
will also install bower dependencies.
Pros : one command to rule them all.
Cons : you unnecessarily embed bower as a dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With