bower.io is a fantastic tool for managing client-side dependencies. When you’re deploying a Node.js app to Heroku, you’ve to add 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 before the start
script is responsible for spinning up your Node.js app.