To automatically install bower and its components, one must
Specify the bower dependency in package.json:
"dependencies": {
"bower": "^1.7.9"
}
Use scripts to execute a postinstall command
"scripts": {
"postinstall": "./node_modules/bower/bin/bower install"
}
Create a .bowerrc file to set the directory for bower_components to install. Otherwise bower_components are installed in root directory.
{
"directory" : "app/bower_components"
}
Now, Heroku automatically executes bower install command after npm install