简体   繁体   中英

rake aborted! couldn't find file twitter/bootstrap

i'm following the Hartl tutorial about ROR 3.2, i build a simple app that works fine locally but when i try to deploy it to heroku wit $git push heroku master , the rake assets:precompile fails because "couldn't find file twitter/bootstrap". (error raised by application.js) I've already google the problem but none of these answers 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

can anyone help me to figure out the problem? If i have to attach some files, or if you needother informations please tell me. Thank you

here 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', '~> 2.0.1.0'
  gem 'bootstrap-sass', '~> 2.0.3'
  gem 'uglifier', '>= 1.0.3'
end

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

I had a similar problem that got fixed by moving bootstrap related gems out of the assets group in gemfile. Paste it alongside the regular list of gems and it should work fine.

Have you added:

# Allow compilation of assests on Heroku
config.assets.initialize_on_precompile = false

to your config/application.rb file? This was the last step I did to fix my Heroku woes.

Also you should be fine leaving gem 'bootstrap-sass', '~> 2.0.3' in your group assets do block despite what I've read online.

Sounds like a problem in your gem file, here's an example one that's working fine on Heroku:

source 'https://rubygems.org'

group :development, :test do
  gem 'rspec-rails', '2.9.0'
  gem 'guard-rspec', '0.5.5'
end

group :test do
  gem 'capybara', '1.1.2'
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'

  gem 'bootstrap-sass', '~> 2.0.3'
end

gem 'rails', '3.2.2'
gem 'pg', '0.13.2'
gem 'jquery-rails', '2.0.2'
gem 'simple_form', '2.0.1'

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'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM