bugman
bugman

Reputation: 315

rake aborted couldn't find file twitter/bootstrap while deploying to heroku

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 .

Upvotes: 3

Views: 4796

Answers (4)

suresh gopal
suresh gopal

Reputation: 3156

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.

Upvotes: 2

qwertoyo
qwertoyo

Reputation: 1402

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 ;)

Upvotes: 0

bugman
bugman

Reputation: 315

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

Upvotes: 0

stecb
stecb

Reputation: 14746

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?

Upvotes: 1

Related Questions