【问题标题】:Heroku w/ sqlite3 issues: Precompiling assets failed. Push rejected, failed to compile Ruby appHeroku w/ sqlite3 问题:预编译资产失败。推送被拒绝,无法编译 Ruby 应用程序
【发布时间】:2014-10-14 15:53:06
【问题描述】:

所以,我在推送到 heroku 时遇到了一个我以前从未见过的错误。我正在积极尝试了解错误的含义,以便修复它。

我发现我的 sqlite3 存在问题,但仍然无法解决。在搞砸了我的 gem 文件,然后花了几个小时让它在我的本地恢复工作后,我在这里寻求帮助。

任何意见将不胜感激!

Haydens-MacBook-Air:TicketFee_Calculator haydengoldman$ git push heroku master
Initializing repository, done.
Counting objects: 215, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (197/197), done.
Writing objects: 100% (215/215), 291.41 KiB | 244.00 KiB/s, done.
Total 215 (delta 66), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.3
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from https://rubygems.org/..........
       Using json 1.8.1
       Installing minitest 5.4.2
       Installing i18n 0.6.11
       Installing rake 10.3.2
       Installing builder 3.2.2
       Installing erubis 2.7.0
       Installing rack 1.5.2
       Installing arel 5.0.1.20140414130214
       Installing mime-types 2.4.1
       Installing sass 3.2.19
       Installing coffee-script-source 1.8.0
       Installing thor 0.19.1
       Installing hike 1.2.3
       Installing multi_json 1.10.1
       Using bundler 1.6.3
       Installing tilt 1.4.1
       Installing thread_safe 0.3.4
       Installing rails_serve_static_assets 0.0.2
       Installing rdoc 4.1.2
       Installing rails_stdout_logging 0.0.3
       Installing rack-test 0.6.2
       Installing bootstrap-sass 3.1.1.0
       Installing execjs 2.2.1
       Installing mail 2.6.1
       Installing tzinfo 1.2.2
       Installing sprockets 2.11.0
       Installing coffee-script 2.3.0
       Installing rails_12factor 0.0.2
       Installing sdoc 0.4.1
       Installing uglifier 2.5.3
       Installing activesupport 4.1.6
       Installing activemodel 4.1.6
       Installing jbuilder 2.2.2
       Installing actionview 4.1.6
       Installing actionpack 4.1.6
       Installing railties 4.1.6
       Installing actionmailer 4.1.6
       Installing activerecord 4.1.6
       Installing sprockets-rails 2.1.4
       Installing coffee-rails 4.0.1
       Installing jquery-rails 3.1.2
       Installing sass-rails 4.0.3
       Installing turbolinks 2.4.0
       Installing rails 4.1.6
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Post-install message from rdoc:
       Depending on your version of ruby, you may need to install ruby rdoc/ri data:
       <= 1.8.6 : unsupported
       = 1.8.7 : gem install rdoc-data; rdoc-data --install
       = 1.9.1 : gem install rdoc-data; rdoc-data --install
       >= 1.9.2 : nothing to do! Yay!
       Bundle completed (22.97s)
       Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       DEPRECATION WARNING: Paths in SQLite3 database URLs of the form `sqlite3:///path` will be treated as absolute in Rails 4.2. Please switch to `sqlite3:dbname`. (called from <top (required)> at /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/Rakefile:6)
       rake aborted!
       Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/connection_specification.rb:190:in `rescue in spec'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/connection_specification.rb:187:in `spec'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:50:in `establish_connection'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:129:in `block (2 levels) in <class:Railtie>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:118:in `block in <class:Railtie>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:300:in `initialize!'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/config/environment.rb:5:in `<top (required)>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:276:in `require_environment!'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:389:in `block in run_tasks_blocks'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.1.4/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
       Gem::LoadError: sqlite3 is not part of the bundle. Add it to Gemfile.
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/bundler-1.6.3/lib/bundler/rubygems_integration.rb:252:in `block in replace_gem'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/sqlite3_adapter.rb:5:in `<top (required)>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/connection_specification.rb:188:in `spec'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_handling.rb:50:in `establish_connection'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:129:in `block (2 levels) in <class:Railtie>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:118:in `block in <class:Railtie>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:54:in `run_initializers'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:300:in `initialize!'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/config/environment.rb:5:in `<top (required)>'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:276:in `require_environment!'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:389:in `block in run_tasks_blocks'
       /tmp/build_4336c1c2-aef4-47f5-a267-de3bc5fa5690/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.1.4/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:ancient-castle-6465.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:ancient-castle-6465.git'

【问题讨论】:

  • Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). 看起来不错,您的 gemfile 中有 gem 'sqlite3' 吗?
  • 我确实有 sqlite 3 gem。我如此困惑的原因之一。这将得到解决,只是需要一些头疼。
  • @HaydenGoldman 如果答案对您有帮助。请采纳答案谢谢

标签: ruby-on-rails heroku sqlite push


【解决方案1】:

Heroku 使用 postgresql 数据库,因此请从 gem 文件中删除 sqlite3 或将其移至开发组并将 gem 'pg' 添加到您的 gem 文件中。关于 database.yml 设置请遵循Heroku setup

【讨论】:

    【解决方案2】:

    确保您已从 Gemfile 中删除 sqlite3 gem 并运行 bundle install。 如果您继续收到此错误,请检查您的 Gemfile.lock,因为某些 gem 将 sqlite3 列为依赖项 - 您也需要删除这些 gem。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-19
      • 1970-01-01
      • 2014-02-08
      • 2023-03-07
      • 1970-01-01
      • 2017-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多