2012-02-07 82 views
0

我嘗試了幾個在github上找到的解決方案(如回滾到0.8.7),但uninitialized constant Rake::DSL從未消失。Rails 3.2.1,使用rake db時未初始化的常量Rake :: DSL:migrate

輸出:

[email protected]:~/apps/dev$ rake db:migrate 
(in /home/bartolsthoorn/apps/dev) 
rake aborted! 
uninitialized constant Rake::DSL 
/home/bartolsthoorn/.bundle/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>' 
/home/bartolsthoorn/.bundle/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<module:Rake>' 
/home/bartolsthoorn/.bundle/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top (required)>' 
/home/bartolsthoorn/.bundle/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top (required)>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/test_unit/testing.rake:2:in `<top (required)>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/test_unit/railtie.rb:12:in `block in <class:TestUnitRailtie>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `instance_exec' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `block in load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `each' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/engine.rb:423:in `block in load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in `each' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in `all' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/engine.rb:423:in `load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/application.rb:145:in `load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing' 
/home/bartolsthoorn/apps/dev/Rakefile:9:in `<top (required)>' 
/opt/lib/ruby/1.9.1/rake.rb:2373:in `load' 
/opt/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' 
/opt/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' 
/opt/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' 
/opt/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' 
/opt/lib/ruby/1.9.1/rake.rb:1991:in `run' 
/opt/bin/rake:31:in `<main>' 

我的包:

Gems included by the bundle: 
    * POpen4 (0.1.4) 
    * Platform (0.4.0) 
    * RedCloth (4.2.9) 
    * actionmailer (3.2.1) 
    * actionpack (3.2.1) 
    * activemodel (3.2.1) 
    * activerecord (3.2.1) 
    * activeresource (3.2.1) 
    * activesupport (3.2.1) 
    * arel (3.0.0) 
    * authlogic (3.1.0) 
    * builder (3.0.0) 
    * bundler (1.0.7) 
    * erubis (2.7.0) 
    * hike (1.2.1) 
    * i18n (0.6.0) 
    * jammit (0.6.5) 
    * journey (1.0.1) 
    * jquery-rails (2.0.0) 
    * json (1.6.5) 
    * mail (2.4.1) 
    * mime-types (1.17.2) 
    * multi_json (1.0.4) 
    * open4 (1.3.0) 
    * polyglot (0.3.3) 
    * rack (1.4.1) 
    * rack-cache (1.1) 
    * rack-ssl (1.3.2) 
    * rack-test (0.6.1) 
    * rails (3.2.1) 
    * railties (3.2.1) 
    * rake (0.9.2.2) 
    * rdoc (3.12) 
    * sprockets (2.1.2) 
    * sqlite3 (1.3.5) 
    * sqlite3-ruby (1.3.3) 
    * thor (0.14.6) 
    * tilt (1.3.3) 
    * treetop (1.4.10) 
    * tzinfo (0.3.31) 
    * yui-compressor (0.9.6) 

當我設置耙0.8.7這是結果:

[email protected]:~/apps/dev$ bundle show rake 
/home/bartolsthoorn/.bundle/gems/rake-0.8.7 
[email protected]:~/apps/dev$ bundle exec rake db:migrate 
(in /home/bartolsthoorn/apps/dev) 
rake aborted! 
uninitialized constant Rake::DSL 
/home/bartolsthoorn/apps/dev/Rakefile:9:in `<top (required)>' 
(See full trace by running task with --trace) 
[email protected]:~/apps/dev$ rake db:migrate 
(in /home/bartolsthoorn/apps/dev) 
rake aborted! 
uninitialized constant Rake::DSL 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/tasks/documentation.rake:11:in `<class:RDocTaskWithoutDescriptions>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/tasks/documentation.rake:10:in `<top (required)>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/tasks.rb:15:in `block in <top (required)>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/tasks.rb:6:in `each' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/tasks.rb:6:in `<top (required)>' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/application.rb:289:in `block in initialize_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `instance_exec' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `block in load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `each' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/engine.rb:424:in `load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/application.rb:145:in `load_tasks' 
/home/bartolsthoorn/.bundle/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing' 
/home/bartolsthoorn/apps/dev/Rakefile:9:in `<top (required)>' 
/opt/lib/ruby/1.9.1/rake.rb:2373:in `load' 
/opt/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' 
/opt/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' 
/opt/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' 
/opt/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' 
/opt/lib/ruby/1.9.1/rake.rb:1991:in `run' 
/opt/bin/rake:31:in `<main>' 

如何解決這一問題上的這一特定建立?

+1

這是一個新的Rails 3.2.1應用程序或一個你從舊版本的框架升級? – 2012-02-07 23:32:10

+0

它最初是爲Rails 3.2.1創建的。它會影響耙子嗎?我已經通過設置'gem'rails','3.1.1'gem「rake」,「0.8.7」'解決了這個問題,但是我認爲這也適用於3.2.1。 – bartolsthoorn 2012-02-08 00:42:12

回答

0

更新:新鮮安裝了ruby -v'1.9.3'// rails -v'3.2.1'。 rake db:migrate現在工作。

您是否檢查了此解決方案?這是similar stackoverflow question的頂級投票解決方案。鏈接上的其他答案可能適用。

將這個在你的Rakefile上述要求「耙」:
require 'rake/dsl_definition'

相關問題