use bower install on heroku

bower.io is awesome for managing client side dependencies. When you're deploying a node app to heroku, you've to add an additional 'script' to your package.json file instead to get bower running right after installing your app using git.

First, you've to ensure that bower is part of your dependencies. Either double-check the dependencies object within your package.json or execute

$ npm install bower --save

Somewhere in your package.json you'll find another object called scripts add a dedicated script for postinstall like shown in the following snippet:

{
  "scripts": {
    "postinstall": "./node_modules/bower/bin/bower install"
  }
}

postinstall will be executed right after you've pushed a new release to heroku and right befor the start script is responsible for spinning up your node app.

Comments

comments powered by Disqus