简体   繁体   English

耙子流产了! 找不到文件twitter / bootstrap

[英]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". 我正在遵循有关ROR 3.2的Hartl教程,我构建了一个在本地运行良好的简单应用,但是当我尝试将其部署到heroku wit $ git push heroku master时,rake asset:precompile失败,因为“找不到文件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 (application.js引发的错误)我已经用谷歌搜索了这个问题,但是这些答案对我都不起作用: 通过twitter-bootstrap-rails gem升级到bootstrap 2.0.1后,Heroku部署失败

Couldn't find file 'twitter/bootstrap' in Production 在生产中找不到文件“ twitter / bootstrap”

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. 我有一个类似的问题,可以通过将与引导程序相关的宝石移出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? 到您的config / application.rb文件? This was the last step I did to fix my Heroku woes. 这是我修复Heroku困境的最后一步。

Also you should be fine leaving gem 'bootstrap-sass', '~> 2.0.3' in your group assets do block despite what I've read online. 同样'bootstrap-sass', '~> 2.0.3'尽管我在网上阅读了很多内容,但您仍然可以在group assets do保留'bootstrap-sass', '~> 2.0.3'阻止,这应该很好。

Sounds like a problem in your gem file, here's an example one that's working fine on Heroku: 在您的gem文件中听起来像是一个问题,这是一个在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 从gemfile中的:assets外部移动twitter-bootstrap-rails gem
  2. Update twitter-bootstrap-rails gem version 2.2.6 or just paste below line in your gemfile. 更新twitter-bootstrap-rails gem版本2.2.6或仅将以下行粘贴到gemfile中。 gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' 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. 如果twitter-bootstrap-rails 2.2.6无法正常工作,请使用twitter-bootstrap-rails gem最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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