rake db:migrate给了我rake aborted错误

时间:2013-01-07 15:44:57

标签: ruby-on-rails

我正在关注Lynda ruby​​ on rails教程。我被要求输入“rake db:migrate”。然而,这是我收到的错误。

lexi87$ rake db:migrate
rake aborted!
/Users/lexi87/Sites/simple_cms/db/migrate/20130107145627_create_users.rb:14: syntax error, unexpected $end, expecting keyword_end
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:537:in `load_migration'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:533:in `migration'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:528:in `migrate'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:777:in `call'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:777:in `ddl_transaction'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:719:in `block in migrate'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:700:in `each'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:700:in `migrate'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:570:in `up'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/migration.rb:551:in `migrate'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:179:in `block (2 levels) in <top (required)>'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `eval'
/Users/lexi87/.rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

我在我应该成为的目录中,这是“sites / simple_cms”。我已经安装了rake并且还运行了“gem install bundle”和“bundle install”。我在目录中完成了这个,然后在“站点目录”甚至主目录中。没有什么能有所作为。

2 个答案:

答案 0 :(得分:1)

/Users/lexi87/Sites/simple_cms/db/migrate/20130107145627_create_users.rb:14: syntax error, unexpected $end, expecting keyword_end

从上面的代码行“语法错误,意外的$ end,期待keyword_end “,我认为您在迁移文件中添加了一个额外的结尾。只需检查您是否有额外的结束,或者您错过了结束迁移文件

答案 1 :(得分:1)

抱歉,我发现了什么问题。我在创建用户文件的底部错过了第二个“结束”。

我在整个教程中都注意到,我必须添加一些他们没有告诉你的行。现在我可以继续我的旅程,感谢你的建议!