简体   繁体   English

耙db:migrate期间出错

[英]Errors during rake db:migrate

I have been trying to upgrade my app from Rails 2.3 to Rails 3. I got the rails s to work with no errors but nothing will come up because I have not migrated the db. 我一直在尝试将我的应用程序从Rails 2.3升级到Rails3。我可以正常使用rails,但是不会出现任何问题,因为我还没有迁移数据库。 There has been numerous errors I have fixed trying to run rake db:migrate but I cannot get past this... 我已经修复了许多错误,试图运行rake db:migrate,但我无法克服这个错误...

rake aborted!
no such file to load -- config/environment

(See full trace by running task with --trace)

my config environment is 我的配置环境是

#Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
AppName::Application.initialize!

with trace 有痕迹

    rake aborted!
    no such file to load -- config/environment
   /Users/Kyle/Desktop/Rails_Projects/unitedaction3/lib/tasks/account.rake:2:in `require'
   /Users/Kyle/Desktop/Rails_Projects/unitedaction3/lib/tasks/account.rake:2:in `<top     (required)>'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.0/lib/rails/engine.rb:131:in `load'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.0/lib/rails/engine.rb:131:in `block in     load_tasks'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.0/lib/rails/engine.rb:131:in `each'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.0/lib/rails/engine.rb:131:in `load_tasks'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.0/lib/rails/application.rb:141:in   `load_tasks'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
   /Users/Kyle/Desktop/Rails_Projects/unitedaction3/Rakefile:9:in `<top (required)>'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in   load_rakefile'
  /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
    /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
   /Users/Kyle/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'

Any ideas? 有任何想法吗?

I'm not sure if you have seen this but there is a rails plugin that provides rake tasks to help with this upgrade: https://github.com/rails/rails_upgrade 我不确定您是否看到过此情况,但是有一个Rails插件提供了rake任务来帮助进行此升级: https : //github.com/rails/rails_upgrade

It gives you: 它为您提供:

rake rails:upgrade:check
rake rails:upgrade:configuration

But I think what you will need to end up doing is generate a new empty rails 3 app and copy the generated config/environment file into your app. 但我认为您最终需要做的是生成一个新的空Rails 3应用程序,并将生成的config/environment文件复制到您的应用程序中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM