Ruby on rails Rails:rake db:migrate->;堆栈级别太深

Ruby on rails Rails:rake db:migrate->;堆栈级别太深,ruby-on-rails,ruby-on-rails-3,migration,rake,Ruby On Rails,Ruby On Rails 3,Migration,Rake,我以前从未见过这种错误,我也不知道我应该寻找什么 $ rake db:migrate --trace (in /Users/tscolari/Projetos/movies) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! stack level too deep /opt/local/li

我以前从未见过这种错误,我也不知道我应该寻找什么

$ rake db:migrate --trace
(in /Users/tscolari/Projetos/movies)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
stack level too deep
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `write'
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `collect'
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `write'
/opt/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.06/lib/scrubyt/utils/ruby_extensions.rb:66:in `write'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:108:in `flush'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:101:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:101:in `flush'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:125:in `auto_flush'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:66:in `add'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/buffered_logger.rb:77:in `debug'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:201:in `log'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/sqlite_adapter.rb:135:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/sqlite_adapter.rb:180:in `tables'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:21:in `table_exists?'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:429:in `initialize_schema_migrations_table'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:487:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:433:in `new'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:433:in `up'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/migration.rb:415:in `migrate'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:142
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/local/bin/rake:19:in `load'
/opt/local/bin/rake:19
首先,我认为我的一次迁移可能有问题,所以我将它们全部删除以进行检查,错误仍然存在。 奇怪的是,应用程序/控制台启动时没有任何问题:

$ rails server
=> Booting Mongrel
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

然后我就不知道去哪里寻找错误了。有什么帮助吗?

有时候db会疯掉的。您可以做的是保存当前模式,然后重置db
rake db:reset
,并进行新迁移
script/generate migration add_old_db
将整个旧模式迁移为新迁移。只需将旧模式复制并粘贴到新迁移中,它就会像以前一样创建新表。当然,您的数据会在这个过程中被销毁。

好的, 我尝试了一切,
rakedb:reset
,删除所有迁移,等等


问题是一块宝石<代码>scrubyt gem在我的gem文件中导致了所有这些麻烦

Ubuntu 20.04上运行Rails 4应用程序时,我遇到了类似的挑战

当我运行命令rake:db migrate时,我得到以下错误:

雷克流产了! SystemStackError:堆栈级别太深 /home/mycomputer/Projects/my project/config/environment.rb:5:in
'/home/mycomputer/.rbenv/versions/2.5.8/bin/bundle:23:in
load' /home/mycomputer/.rbenv/versions/2.5.8/bin/bundle:23:in`' 任务:TOP=>db:migrate=>environment (通过使用--trace运行任务查看完整跟踪)

以下是我如何修复它的方法

经过数小时的调试,我发现问题是由一些过时的gem引起的,它们导致了一些依赖性问题

我所做的只是使用以下命令将gems更新为与项目兼容的版本:

bundle update
您还可以注释掉gems,并在取消注释每个gems后尝试一个接一个地安装它们。如果您足够幸运地跟踪导致问题的gem,那么您可以只使用

bundle update gem_name
另一种方法是删除
Gemfile.lock
文件,然后使用以下方法重新安装gems,尽管这是不可取的(因为您可能会遇到一些依赖项兼容性问题):

bundle install 

就这些


我希望这有帮助

此错误是否发生在开发环境之外?另外,我注意到在
scrubyt
中跟踪失败--您可以禁用此gem并重试迁移吗?在某种程度上,我的问题与您的问题类似,请检查我的问题:
bundle update