Rails 3.0 & Ruby 1.9.2rc: Rake commands return 'already initialized constant' & stack level too deep errors. Any ideas

前端 未结 13 1985
天涯浪人
天涯浪人 2020-12-08 07:19

I\'m trying to run Rails 3 beta 4 & Ruby 1.9.2rc on Ubuntu 10.04. It worked initially, but after doing my first bundle install/package, I now get the following errors in

相关标签:
13条回答
  • 2020-12-08 08:06

    As per the previous message from Eric W. the RUBYOPT environment variable is set. If you want to exit the new bash shell that is opened by "bundle exec bash" then just copy the RUBYOPT environment line, exit the shell then type "export RUBYOPT='THE ARGS THAT YOU COPIED FROM THE PREVIOUS ENVIRONMENT'

    Note: this works with ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0] , Rails 3.0.7, gem 1.8.0 and Rake 0.8.7

    0 讨论(0)
  • 2020-12-08 08:07

    I've been running into this issue too. It doesn't seem to be related to the specific versions of rails or ruby you mention, which are different than the ones I'm using (Rails 2.3.8, Rake 0.8.7, Ruby 1.9.1p378). It seems to be related to bundler and rake not working well together.

    A resolution that worked for me is mentioned at the bottom of this lighthouse ticket. Here is the short version:

    • Run "bundle exec bash"; see if rake works now - if it does,
    • Make sure that the bash environments, before and after, are the same by consulting the env command and modifying ~/.bashrc or ~/.bash_profile accordingly.

    Once you do this, you mess up bundler a little bit. At that point you have to clear RUBYOPT in order to run the bundle command:

    RUBYOPT= bundle install --relock
    

    EDIT:

    Thinking about it a little more, I'm not sure this is necessarily the best way to address this particular issue. You might give Hiral Desai's tip and some other answers a try before resorting to this approach, since this one changes the environment.

    0 讨论(0)
  • 2020-12-08 08:07

    Just got such error because of deleted .rvmrc

    So please make sure you running rake in correct environment ;)

    0 讨论(0)
  • 2020-12-08 08:09

    Another possible solution is given at http://rubyist-journal.com/2011/07/29/howto-fix-rake-0-9-2-to-work-with-ruby-1-9-2-under-rvm/

    It seems to boil down to having the same rake gem installed both in your user gem directory and system-wide. Removing either one fixes the issue.

    0 讨论(0)
  • 2020-12-08 08:09

    This can happen when you have the rake gem installed in both your repo's rvm gemset and the global one.

    0 讨论(0)
  • 2020-12-08 08:13

    I've been running into this issue too after updating rubygem (1.8.10) and bundler (1.0.18)

    I solved updating rake to 0.9.2

    0 讨论(0)
提交回复
热议问题