Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install my bower dependencies on a deployed Heroku app? [duplicate]

I'll try to simplify this problem down:

I am deploying an application using Heroku, and I would like to automatically install my bower dependencies. When testing on a localhost, I would just run a "bower install" command in the terminal, but I am not sure how to translate this over to a deployed application.

like image 844
Nick Mandel Avatar asked Dec 11 '25 18:12

Nick Mandel


1 Answers

You’ll need to install Bower as a dependency to your app in package.json.

npm install --save bower

You will then need to add a post install script in package.json with the path to your bower dependency inside node_modules, it should look like this

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

After the npm package is installed by Heroku, this script will be executed and your bower dependencies will be automatically installed!

I wrote a blog post about this not too long ago actually that goes into a little bit more detail: http://www.catherinebui.com/post/105338527207/deploying-node-js-app-on-heroku-with-bower#105338527207

like image 80
gladwearefriends Avatar answered Dec 13 '25 06:12

gladwearefriends