我在使用Rails 4.2.6的Ruby 2.3.1时出现了堆栈级别太深的错误。 我该如何解决这个问题?
在执行以下命令时,出现错误。
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运行bundle exec rake db:migrate
也不起作用。
无法理解为什么仍然存在此错误。 有人帮我吗?
答案 0 :(得分:0)
我已删除此错误。 生产的红宝石版本为2.5.0,这是不合适的。 我的版本下降到2.4.5。从2.5.0版开始,那么它可以正常工作。