我以前从未见过这个错误,我不知道我应该找什么。
$ 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
然后我就不知道去哪里找错误了。有什么帮助吗?
3条答案
按热度按时间ymdaylpp1#
好吧,我尝试了所有方法,
rake db:reset
,删除所有迁移,等等...问题是一个gem.
scrubyt gem
在我的 gemfile 造成了所有这些麻烦...20jt8wwn2#
我在Ubuntu 20.04上开发Rails 4应用程序时遇到了类似的挑战。
当我运行
rake:db migrate
命令时,我得到以下错误:rake aborted!SystemStackError:堆栈级别太深/home/mycomputer/Projects/my-project/config/environment.rb:5:in
<top (required)>' /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更新到与项目兼容的版本:
你也可以注解掉gem,然后尝试在取消注解后一个接一个地安装它们。如果你足够幸运地追踪到导致问题的gem,那么你可以只使用
另一种方法,虽然不可取(因为您可能会遇到一些依赖兼容性问题),但将删除您的
Gemfile.lock
文件,然后使用以下命令重新安装您的gems:或者:
vx6bjr1n3#
有时数据库会出错。你可以做的是保存你当前的模式,然后重置你的数据库
rake db:reset
,并进行一次新的迁移script/generate migration add_old_db
,将你的整个旧模式作为新的迁移。只需将你的旧模式复制并粘贴到新的迁移中,它就会像以前一样生成新的表。当然,你的数据会在这个过程中被破坏。