首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rake db:migrate出现rake中止错误

rake db:migrate出现rake中止错误
EN

Stack Overflow用户
提问于 2013-01-07 23:44:57
回答 2查看 1.4K关注 0票数 0

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

代码语言:javascript
复制
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)

我在我应该在的目录中,这个目录是“site/simple_cms”。我已经安装了rake,还运行了"gem install bundle“和"bundle install”。我在目录中这样做了,然后在“站点目录”中,甚至在主目录中。没有什么是不同的。

EN

回答 2

Stack Overflow用户

发布于 2013-01-08 00:11:27

代码语言:javascript
复制
/Users/lexi87/Sites/simple_cms/db/migrate/20130107145627_create_users.rb:14: syntax error, unexpected $end, expecting keyword_end

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

票数 1
EN

Stack Overflow用户

发布于 2013-01-08 09:52:40

对不起,我已经发现了问题所在。我在create users文件的底部遗漏了第二个"end“。

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14199210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档