ruby-on-rails 无法将ruby项目部署到Heroku - rails中止

jtw3ybtb  于 2023-06-25  发布在  Ruby
关注(0)|答案(1)|浏览(135)

我正在将Rails项目从Gitpod部署到Heroku,但它不会部署。根据我在网上搜索的内容,我尝试了许多解决方案,但都不起作用。
有谁知道怎么解决这个问题吗?
这是错误日志:

gitpod /workspace/turboprompts $ git push heroku HEAD:main -f
Enumerating objects: 288, done.
Counting objects: 100% (288/288), done.
Delta compression using up to 16 threads
Compressing objects: 100% (269/269), done.
Writing objects: 100% (288/288), 77.51 KiB | 7.75 MiB/s, done.
Total 288 (delta 115), reused 100 (delta 2), pack-reused 0
remote: Resolving deltas: 100% (115/115), done.
remote: Updated 120 paths from 2ee31ce
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.25
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.3
remote: -----> Installing dependencies using bundler 2.3.25
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Fetching gem metadata from https://rubygems.org/..........
remote:        Fetching rake 13.0.6
remote:        Installing rake 13.0.6
remote:        Fetching thread_safe 0.3.6
remote:        Fetching zeitwerk 2.6.8
remote:        Fetching concurrent-ruby 1.2.2
remote:        Fetching minitest 5.18.1
remote:        Installing minitest 5.18.1
remote:        Installing zeitwerk 2.6.8
remote:        Installing thread_safe 0.3.6
remote:        Fetching builder 3.2.4
remote:        Fetching erubi 1.12.0
remote:        Installing erubi 1.12.0
remote:        Installing builder 3.2.4
remote:        Fetching racc 1.7.1
remote:        Fetching crass 1.0.6
remote:        Fetching rack 2.2.7
remote:        Installing crass 1.0.6
remote:        Fetching nio4r 2.5.9
remote:        Installing rack 2.2.7
remote:        Installing nio4r 2.5.9 with native extensions
remote:        Fetching websocket-extensions 0.1.5
remote:        Installing racc 1.7.1 with native extensions
remote:        Installing websocket-extensions 0.1.5
remote:        Fetching marcel 1.0.2
remote:        Installing marcel 1.0.2
remote:        Fetching mini_mime 1.1.2
remote:        Installing mini_mime 1.1.2
remote:        Fetching date 3.3.3
remote:        Installing concurrent-ruby 1.2.2
remote:        Installing date 3.3.3 with native extensions
remote:        Fetching timeout 0.3.2
remote:        Installing timeout 0.3.2
remote:        Fetching public_suffix 5.0.1
remote:        Installing public_suffix 5.0.1
remote:        Fetching bcrypt 3.1.18
remote:        Installing bcrypt 3.1.18 with native extensions
remote:        Fetching msgpack 1.7.1
remote:        Installing msgpack 1.7.1 with native extensions
remote:        Using bundler 2.3.25
remote:        Fetching unf_ext 0.0.8.2
remote:        Installing unf_ext 0.0.8.2 with native extensions
remote:        Fetching faraday-net_http 3.0.2
remote:        Installing faraday-net_http 3.0.2
remote:        Fetching ruby2_keywords 0.0.5
remote:        Installing ruby2_keywords 0.0.5
remote:        Fetching multipart-post 2.3.0
remote:        Installing multipart-post 2.3.0
remote:        Fetching ffi 1.15.5
remote:        Installing ffi 1.15.5 with native extensions
remote:        Fetching http-form_data 2.3.0
remote:        Installing http-form_data 2.3.0
remote:        Fetching method_source 1.0.0
remote:        Installing method_source 1.0.0
remote:        Fetching pg 1.5.3
remote:        Installing pg 1.5.3 with native extensions
remote:        Fetching thor 1.2.2
remote:        Installing thor 1.2.2
remote:        Fetching tilt 2.2.0
remote:        Installing tilt 2.2.0
remote:        Fetching tzinfo 1.2.11
remote:        Installing tzinfo 1.2.11
remote:        Fetching rack-test 2.1.0
remote:        Installing rack-test 2.1.0
remote:        Fetching websocket-driver 0.7.5
remote:        Installing websocket-driver 0.7.5 with native extensions
remote:        Fetching i18n 1.14.1
remote:        Installing i18n 1.14.1
remote:        Fetching sprockets 3.7.2
remote:        Installing sprockets 3.7.2
remote:        Fetching net-protocol 0.2.1
remote:        Installing net-protocol 0.2.1
remote:        Fetching addressable 2.8.4
remote:        Installing addressable 2.8.4
remote:        Fetching puma 4.3.12
remote:        Installing puma 4.3.12 with native extensions
remote:        Fetching nokogiri 1.15.2 (x86_64-linux)
remote:        Installing nokogiri 1.15.2 (x86_64-linux)
remote:        Fetching faraday 2.7.6
remote:        Installing faraday 2.7.6
remote:        Fetching faraday-multipart 1.0.4
remote:        Installing faraday-multipart 1.0.4
remote:        Fetching bootsnap 1.16.0
remote:        Installing bootsnap 1.16.0 with native extensions
remote:        Fetching unf 0.1.4
remote:        Installing unf 0.1.4
remote:        Fetching activesupport 6.0.6.1
remote:        Installing activesupport 6.0.6.1
remote:        Fetching faker 3.2.0
remote:        Fetching net-imap 0.3.6
remote:        Installing net-imap 0.3.6
remote:        Fetching net-pop 0.1.2
remote:        Installing net-pop 0.1.2
remote:        Fetching net-smtp 0.3.3
remote:        Installing net-smtp 0.3.3
remote:        Fetching loofah 2.21.3
remote:        Installing loofah 2.21.3
remote:        Fetching ruby-openai 4.1.0
remote:        Installing ruby-openai 4.1.0
remote:        Fetching ffi-compiler 1.0.1
remote:        Installing ffi-compiler 1.0.1
remote:        Fetching sassc 2.4.0
remote:        Installing sassc 2.4.0 with native extensions
remote:        Installing faker 3.2.0
remote:        Fetching domain_name 0.5.20190701
remote:        Installing domain_name 0.5.20190701
remote:        Fetching rails-dom-testing 2.0.3
remote:        Installing rails-dom-testing 2.0.3
remote:        Fetching globalid 1.1.0
remote:        Installing globalid 1.1.0
remote:        Fetching activemodel 6.0.6.1
remote:        Installing activemodel 6.0.6.1
remote:        Fetching mail 2.8.1
remote:        Fetching rails-html-sanitizer 1.6.0
remote:        Installing rails-html-sanitizer 1.6.0
remote:        Fetching llhttp-ffi 0.4.0
remote:        Installing llhttp-ffi 0.4.0 with native extensions
remote:        Fetching http-cookie 1.0.5
remote:        Installing http-cookie 1.0.5
remote:        Fetching activejob 6.0.6.1
remote:        Installing mail 2.8.1
remote:        Fetching activerecord 6.0.6.1
remote:        Installing activerecord 6.0.6.1
remote:        Fetching actionview 6.0.6.1
remote:        Installing actionview 6.0.6.1
remote:        Installing activejob 6.0.6.1
remote:        Fetching actionpack 6.0.6.1
remote:        Fetching jbuilder 2.11.5
remote:        Installing actionpack 6.0.6.1
remote:        Fetching actioncable 6.0.6.1
remote:        Installing actioncable 6.0.6.1
remote:        Fetching activestorage 6.0.6.1
remote:        Installing activestorage 6.0.6.1
remote:        Fetching actionmailer 6.0.6.1
remote:        Installing actionmailer 6.0.6.1
remote:        Fetching railties 6.0.6.1
remote:        Installing jbuilder 2.11.5
remote:        Fetching sprockets-rails 3.4.2
remote:        Installing sprockets-rails 3.4.2
remote:        Fetching actionmailbox 6.0.6.1
remote:        Installing actionmailbox 6.0.6.1
remote:        Fetching actiontext 6.0.6.1
remote:        Installing actiontext 6.0.6.1
remote:        Installing railties 6.0.6.1
remote:        Fetching rails 6.0.6.1
remote:        Installing rails 6.0.6.1
remote:        Fetching sassc-rails 2.1.2
remote:        Installing sassc-rails 2.1.2
remote:        Fetching http 5.1.1
remote:        Installing http 5.1.1
remote:        Bundle complete! 36 Gemfile dependencies, 75 gems now installed.
remote:        Gems in the groups 'development' and 'test' were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Bundle completed (174.55s)
remote:        Cleaning up the bundler cache.
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        I, [2023-06-23T15:35:23.635140 #1486]  INFO -- : Writing /tmp/build_c66100e7/public/assets/speedometer-fcbb4a67188e3eab739ecbf5e3bab3df1370b1e400dcc0187dd1f98e0d67ddb7.svg
remote:        I, [2023-06-23T15:35:23.635564 #1486]  INFO -- : Writing /tmp/build_c66100e7/public/assets/speedometer-fcbb4a67188e3eab739ecbf5e3bab3df1370b1e400dcc0187dd1f98e0d67ddb7.svg.gz
remote:        I, [2023-06-23T15:35:23.640397 #1486]  INFO -- : Writing /tmp/build_c66100e7/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css
remote:        I, [2023-06-23T15:35:23.640683 #1486]  INFO -- : Writing /tmp/build_c66100e7/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz
remote:        Asset precompilation completed (0.89s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote: -----> Detecting rails configuration
remote: 
remote: ###### WARNING:
remote: 
remote:        Removing `vendor/bundle`.
remote:        Checking in `vendor/bundle` is not supported. Please remove this directory
remote:        and add it to your .gitignore. To vendor your gems with Bundler, use
remote:        `bundle pack` instead.
remote: 
remote: ###### WARNING:
remote: 
remote:        Detecting rails configuration failed
remote:        set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
remote: 
remote: ###### WARNING:
remote: 
remote:        There is a more recent Ruby version available for you to use:
remote:        
remote:        2.7.8
remote:        
remote:        The latest version will include security and bug fixes. We always recommend
remote:        running the latest version of your minor release.
remote:        
remote:        Please upgrade your Ruby version.
remote:        
remote:        For all available Ruby versions see:
remote:          https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote: 
remote: ###### WARNING:
remote: 
remote:        Potential EOL Ruby Version
remote:        
remote:        You are using a Ruby version that has either reached its End of Life (EOL)
remote:        or will reach its End of Life on December 25th of this year.
remote:        
remote:        We suggest you upgrade to Ruby 3.0.x or later
remote:        
remote:        Once a Ruby version becomes EOL, it will no longer receive
remote:        security updates from Ruby core and may have serious vulnerabilities.
remote:        
remote:        Please upgrade your Ruby version.
remote:        
remote:        For a list of supported Ruby versions see:
remote:          https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote: 
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types     -> release, web
remote:        Default types for buildpack -> console, rake
remote: 
remote: -----> Compressing...
remote:        Done: 67.2M
remote: -----> Launching...
remote:  !     Release command declared: this new release will not be available until the command succeeds.
remote:        Released v5
remote:        https://turboprompts-16c907a5eb2e.herokuapp.com/ deployed to Heroku
remote: 
remote: This app is using the Heroku-20 stack, however a newer stack is available.
remote: To upgrade to Heroku-22, see:
remote: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack
remote: 
remote: Verifying deploy... done.
remote: Running release command...
remote: 
remote: rails aborted!
remote: LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile.
remote: /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.25/lib/bundler/rubygems_integration.rb:280:in `block (2 levels) in replace_gem'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `<main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1058:in `establish_connection'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_handling.rb:51:in `establish_connection'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/railtie.rb:201:in `block (2 levels) in <class:Railtie>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/base.rb:327:in `<module:ActiveRecord>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/base.rb:27:in `<main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/railties/databases.rake:19:in `block (2 levels) in <main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:48:in `invoke'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/commands.rb:18:in `<main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: bin/rails:9:in `<main>'
remote: 
remote: Caused by:
remote: Gem::LoadError: sqlite3 is not part of the bundle. Add it to your Gemfile.
remote: /app/vendor/bundle/ruby/2.7.0/gems/bundler-2.3.25/lib/bundler/rubygems_integration.rb:280:in `block (2 levels) in replace_gem'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `<main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1058:in `establish_connection'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/connection_handling.rb:51:in `establish_connection'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/railtie.rb:201:in `block (2 levels) in <class:Railtie>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/base.rb:327:in `<module:ActiveRecord>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/base.rb:27:in `<main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.6.1/lib/active_record/railties/databases.rake:19:in `block (2 levels) in <main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/command.rb:48:in `invoke'
remote: /app/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6.1/lib/rails/commands.rb:18:in `<main>'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: /app/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
remote: bin/rails:9:in `<main>'
remote: Tasks: TOP => db:migrate => db:load_config
remote: (See full trace by running task with --trace)
remote: Waiting for release.... failed.
To https://git.heroku.com/turboprompts.git
 * [new branch]      HEAD -> main

我尝试修复Gemfile和Gemfile.lock,但它不会工作。
我还尝试部署了一个可以工作的空白Rails项目,也得到了同样的错误。
为了测试正在发生的事情,我的一个朋友在他的电脑中部署了Gitpod的完全相同的项目,它确实起作用了。问题可能出在我的电脑上吗?
我还尝试了一个新的Gitpod帐户,和一个新的Heroku帐户,从一个空白项目,从不同的浏览器。我也犯了同样的错误!
错误日志说它找不到sqlite3 gem,但我已经有了它。以下是我的Gemfile的一部分:

[...]

group :development, :test do
  gem 'amazing_print'
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'dotenv-rails'
  gem 'grade_runner', github: 'firstdraft/grade_runner'
  gem 'pry-rails'
  gem 'sqlite3', '~> 1.4.1'
  gem 'table_print'
  gem 'web_git', github: 'firstdraft/web_git'
end

[...]
l7wslrjt

l7wslrjt1#

SQLite gem是开发环境,而heroku环境是生产环境。Gemfile有多个特定于环境的gem。将sqlite3 gem移出开发组。像这样;

[...]
gem 'sqlite3', '~> 1.4.1'

group :development, :test do
  gem 'amazing_print'
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'dotenv-rails'
  gem 'grade_runner', github: 'firstdraft/grade_runner'
  gem 'pry-rails'
  gem 'table_print'
  gem 'web_git', github: 'firstdraft/web_git'
end

[...]

相关问题