2014-10-01 68 views
0

我試圖從新安裝的rails版本去。創建項目並根據我使用rails搭建的模型遷移數據庫。我遇到了一個不知道如何構建任務'db :: migrate'的錯誤。Rake中止:不知道如何在安裝rails後遷移

命令我跑..

刪除所有寶石:
for i in 'gem list --no-versions'; do gem uninstall -aIx $i; done

安裝導軌和創建新項目的
sudo gem install rails
rails new test-api
rails generate controller user index
rails generate model user name:string

所以這是我的設置..

然後我做的方法遷移我的數據庫:
rake db::migrate

這裏是我的輸出:

rake db::migrate 
rake aborted! 
Don't know how to build task 'db::migrate' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `block in load' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/command_wrapper.rb:40:in `call' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:180:in `block in serve' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:153:in `fork' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:153:in `serve' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `run' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>' 
-e:1:in `<main>' 
(See full trace by running task with --trace) 

回答

0

我找到了解決辦法。如果我只是更新我的服務器上我的網頁,我會發現這一點:

enter image description here

這給了我答案,只是運行此命令:

bin/rake db:migrate RAILS_ENV=development 
相關問題