2013-01-07 72 views
0

我跟隨Lynda ruby​​ on rails教程。我被要求輸入「rake db:migrate」。但是,這是我收到的錯誤。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」。我已經在目錄中完成了這個,然後在「網站目錄」甚至主目錄中完成了。沒有什麼區別。

+1

顯示文件DB的內容/遷移/ 20130107145627_create_users.rb –

+0

類調​​用createUsers <的ActiveRecord ::遷移 高清self.up CREATE_TABLE:用戶做| T | t.string「first_name」,:limit => 25 t.string「last_name」,:limit => 50 t.string「email」,:default =>「」,:null => false t.string 「密碼」,:限=> 40個 t.timestamps 結束 結束 高清self.down drop_table:用戶 結束 –

+1

找到答案,需要額外的「結束」 –

回答

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

從代碼的上面一行「語法錯誤,意想不到的$結束,預計keyword_end 」,我認爲你已經添加在遷移文件中的額外結束。只是檢查你是否有額外的結束,或者你錯過了在遷移文件結束

+1

我已經找到了答案,但它不會請允許我現在發佈答案。我在底部錯過了一個額外的「結束」。 –

1

對不起,我已經發現了什麼是錯的。我錯過了創建用戶文件底部的第二個「結束」。

我一直在注意整個教程,有我不得不補充,他們不告訴你的線。現在我可以繼續我的旅程,謝謝你們的建議!