rake aborted! stack level too deep [duplicate]

2019-02-08 20:37发布

问题:

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

Am using Ruby version 1.9.1 on windows vista. Am getting the rake aborted error for any rake commands am using. This does not happen in all my app folder. Its happening only on a specific app folder.

C:\rails_project\stunetwork>rake db:reset
(in C:/rails_project/stunetwork)
rake aborted!
stack level too deep
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rak
efile'
(See full trace by running task with --trace)

回答1:

try placing bundle exec in front of the rake command.

bundle exec rake -T


回答2:

You need to update your gem. I met this error with gem '1.8.10', and fixed by upgrading to 1.8.16

gem update --system



回答3:

I only had this problem with ruby-1.9.2-p180 via rvm.

Switching to ruby-1.9.2-p0 fixed the problem. try "rvm use 1.9.2-p0"



回答4:

The stack of the calls can depend on the gems you install (some gems monkeypatch the rails tasks) which explains why you would encounter this on a specific app and not on others.

On a unix system you could try using the ulimit command to increase your stack size. On the windows side I haven't found a solution yet.

Depending on which release of ruby you use on windows you may want to ask the maintainers how to increase the stack.

For ruby installer you will need to install the mingw compile environment, clone the github repository and recompile the ruby you use (not very sexy I admit).



回答5:

I just encountered this exact error message on Ubuntu, and was able to solve it by downgrading rubygems from 1.8.3 to 1.7.1.



回答6:

There is nice post by Yehuda Katz that explains why without bundle exec there can be version conflicts: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/

There is also bundle install --binstubs command that allows to version-safely run rake db:reset like this: bin/rake db:reset.