Need help resolving RAILS 3.0.9 migration issue
I'm having some serious rails issues. I haven't used it in quite some time so I went through and updated rvm, rails, etc. I'm currently running the following:
RVM -- rvm 1.6.25 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
RAILS -- Rails 3.0.9
RUBY -- ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
I perform the following steps:
rails new my_project
cd my_project
bundle install
rails g scaffold pers开发者_如何学JAVAon first_name:string last_name:string
rake db:migrate
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
rake aborted!
stack level too deep
Thanks in advance!
Solution copied from my blog: http://joneslee85.wordpress.com/2011/07/29/howto-fix-rake-0-9-2-to-work-with-ruby-1-9-2-under-rvm/
BEST WAY: I do not think reverting to 0.8.7 is the best answer because if you compile 1.9.2 with RVM, you will bump into this issue. Here is how to fix this babe:
gem list | grep 'rake'
and you will see thisrake (0.9.2 ruby)
. Now please carefully pay attention to the keyword "ruby" is the evil-doer, it's actually the duplication of rake in @global folder. I think this could be RVM bug.- Now we need to remove rake, please do:
gem uninstall rake
, say Y when it warns that it will break dependencies and also say Y if it asks to remove the executable 'rake'. - Now, check again
gem list | grep 'rake'
and you will simply seerake (0.9.2)
That would fix this issue.
SECOND WAY: Revert to 0.8.7
Okay, you WILL NOT be able to uninstall rake 0.9.2 because RVM installed rake into @global
folder. So here is how you can delete rake 0.9.2 manually before installing rake 0.8.7:
gem list -d rake
and pay attention to the Installed at: /Users/mojo/.rvm/gems/ruby-1.9.2-p290@global in the output. Yours will differ from mine so please be aware, now we need to remove rake with following commands:
NOTE: make sure you escape the character @ with an \
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/bin/rake
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/cache/rake-0.9.2.gem
rm -rf /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/doc/rake-0.9.2/
rm -rf /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/gems/rake-0.9.2/
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/specifications/rake-0.9.2.gemspec
Next is to install rake 0.8.7 with gem install rake -v=0.8.7
Remove rake 0.9.2 and install rake 0.8.7 and see if it works.
The rake 0.9.x branch has been well known to break any rails install completely.
精彩评论