rharriso / bower-rails

Bundler-like DSL + rake tasks for Bower on Rails
MIT License
1.46k stars 128 forks source link

Deploy to heroku problem. #149

Closed imgarylai closed 9 years ago

imgarylai commented 9 years ago

This is an useful gem to integrate rails with bower. However, I met some problem when I tried to deploy to heroku.

I'll try my best to describe my process of deploying to heroku. If there are problems of question , please comment below. I'll provide more information.

I think that if a rails app with bower want to deploy to heroku, the enviroment should be setup with nodejs and rails.

Thus, I have to create a heroku app in this way, https://github.com/ddollar/heroku-buildpack-multi, right?

I succeed to build the environment on heroku so far. However, when the step went to asset:precompile, there are problems. I got messages below:

...
remote:        Sprockets::FileNotFound: couldn't find file 'jquery-twzipcode'
remote:        (in /tmp/build_547a41e1b95461fa0a9bc25dd2d62095/app/assets/javascripts/application.js:6)
...

The asset display in messages was installed by bower.

I read this https://github.com/rharriso/bower-rails/issues/124, but my project use lots of assets are installed by bower. I don't want to checkin my repo. Is there any solution?

The best way, I expect, is that I don't have to check in bower_components and app can be installed automatically when it be deployed.

imgarylai commented 9 years ago

I found the problem. The configuration, bower_rails.install_before_precompile = true should be set to true.

SergeyKishenin commented 9 years ago

Thanks for following up!

obahareth commented 7 years ago

I'm having the same issue ONLY on Heroku with angular: Sprockets::FileNotFound: couldn't find file 'angular' with type 'application/javascript'

and I have this configuration set: bower_rails.install_before_precompile = true

This is how my application.js looks like:

//= require jquery
//= require jquery_ujs
//= require angular/angular
//= require angular-route/angular-route
//= require angular-loader/angular-loader
//= require angular-rails-templates
//= require_tree ./templates

I can run RAILS_ENV=production rake assets:clean assets:precompile locally just fine.