【问题标题】:stack level too deep (SystemStackError) while deploy heroku部署heroku时堆栈级别太深(SystemStackError)
【发布时间】:2019-08-14 13:02:03
【问题描述】:

我在使用 Ruby 2.3.1 和 Rails 4.2.6 时遇到堆栈级别太深的错误。 我该如何解决这个问题?

当我运行下面的命令时,出现了错误。

heroku run rails db:migrate

这是错误。

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Traceback (most recent call last):
    8390: from /app/bin/bundle:3:in `<main>'
    8389: from /app/bin/bundle:3:in `load'
    8388: from /app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
    8387: from /app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
    8386: from /app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:123:in `rescue in with_friendly_errors'
    8385: from /app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:45:in `log_error'
    8384: from /app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:95:in `request_issue_report_for'
    8383: from /app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/env.rb:18:in `report'
     ... 8378 levels...
       4: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
       3: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
       2: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
       1: from /app/vendor/bundle/ruby/2.5.0/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-4.2.6/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)

这是 Gemfile.rb

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.8'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.13', '< 0.5', group: :development
gem 'pg', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc



# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

  gem 'pry-rails'
  gem 'compass-rails','~> 2.0'
  gem 'sprockets', '2.11.0'
  gem 'devise'
  gem 'omniauth'
  gem 'omniauth-facebook'
  gem 'omniauth-twitter'
  gem 'bootstrap-sass'
  gem 'dotenv-rails'
  gem 'paperclip'
  gem 'omniauth-instagram'
  gem 'instagram'
  gem 'friendly_id'
  gem 'font-awesome-rails'
  gem 'zeroclipboard-rails'
  gem 'rails-i18n'
  gem 'google-analytics-rails'
  gem 'carrierwave'
  gem 'acts_as_paranoid', '~> 0.6.0'
  gem 'rails_12factor', group: :production

我将 rails 版本从 4.2.6 更新到了 4.2.8。但还是有同样的问题。

甚至,heroku run bundle exec rake db:migrate 也不起作用。

不明白为什么仍然有这个错误。 有人帮我吗?

【问题讨论】:

  • 您可以发布您的config/database.yml 文件吗?当然要混淆任何真实的安全凭证。此外,如果您升级 Rails,您需要运行 bundle update
  • bundle exec rake db:rollback db:migrate 在本地工作吗?

标签: ruby-on-rails ruby heroku ruby-on-rails-4.2 ruby-2.3.1


【解决方案1】:

我已删除此错误。 生产中的 ruby​​ 版本是 2.5.0,这是不合适的。 我的版本降低了 2.4.5。从 2.5.0 开始,它就可以工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 2013-10-05
    • 2014-10-25
    • 2017-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多