3

i'm trying to deploy an app that works fine in development, but when I push it to heroku with $git push heroku master , the rake assets:precompile fails because "couldn't find file twitter/bootstrap". (error raised by application.js)

I've already googled the problem and found a huge variety of answers but none of these work for me: Heroku deploy fails after upgrading to bootstrap 2.0.1 via twitter-bootstrap-rails gem

Couldn't find file 'twitter/bootstrap' in Production

Rails3 couldn't find file 'bootstrap'

-i've tried to add config.assets.precompile = false

can anyone help me to figure out the problem? i can't really understand. Thank you.

here is the Gemfile

gem 'rails', '3.2.6'

group :development do
gem 'sqlite3'
gem 'annotate', '~> 2.4.1.beta'
end

group :production do
  gem 'pg'
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"
  gem 'bootstrap-sass', '~> 2.0.3'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'bcrypt-ruby', '3.0.1'

The application.css:

 *= require_self
 *= require_tree .

and this is the application.js

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require bootstrap
//= require_tree .
Community
  • 1
  • 1
bugman
  • 315
  • 2
  • 5
  • 16

4 Answers4

2

I solved this issue by using following steps:

  1. Move twitter-bootstrap-rails gem from outside of :assets in gemfile.
  2. Update twitter-bootstrap-rails gem version 2.2.6 or just paste below line in your gemfile. gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'

(or)

if twitter-bootstrap-rails 2.2.6 is not working then Use twitter-bootstrap-rails gem latest version.

suresh gopal
  • 3,138
  • 6
  • 27
  • 58
1

Why are you including 2 times bootstrap?

//= require twitter/bootstrap
//= require bootstrap

U should include it just in the 2nd way (//= require bootstrap) and it should work properly.

Edit: I'm just using gem 'bootstrap-sass', '~> 2.0.2' therefore I just need //= require bootstrap ..if you're using also the other gem you just need the 1st line and the problem I can imagine still remains. Have you tried without using the static branch?

stecb
  • 14,478
  • 2
  • 50
  • 68
  • i tried but now the error is "application.css has already been required" – bugman Jul 02 '12 at 10:16
  • it, still don't work; i have to use the static branch because else in windows, when i run bundle install, i receive an error about therubyracer – bugman Jul 02 '12 at 10:32
0

in my case remove application.css.scss resolve the issue (i don't get errors anymore when i'm tring to deploy to heroku) but when i try to access to my app heroku says "We're sorry, but something went wrong"

running heroku rake db:migrate at the end works fine for me and now everything is ok

bugman
  • 315
  • 2
  • 5
  • 16
0

read this: https://github.com/seyhunak/twitter-bootstrap-rails/issues/123

try to:

  1. remove bootstrap files from app/assets/javascript and app/assets/stylesheets
  2. rails g bootstrap:install
  3. push to heroku

also, try to move the gem out the assets group

edit: nvm, didn't see your answer, you should approve it ;)

qwertoyo
  • 1,332
  • 2
  • 15
  • 31