简体   繁体   中英

Ruby: stack level too deep (SystemStackError)

Ruby is crashing in Cygwin for rails and bundler.

$ ruby -v
ruby 1.9.3p374 (2013-01-15 revision 38858) [i386-cygwin]

Chloe@dumbopc /cygdrive/c/Sites
$ rails -v
Rails 3.2.11

Chloe@dumbopc /cygdrive/c/Sites
$ cd testapp

Chloe@dumbopc /cygdrive/c/Sites/testapp
$ rails -v
/usr/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:114: stack level too 
deep (SystemStackError)

Chloe@dumbopc /cygdrive/c/Sites/testapp
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb:32: 
stack level too deep (SystemStackError) 

I tried both versions of Ruby, ruby 1.9.3p327 and ruby-1.9.3-p374-1. I found something from Google that hinted that 1.9.2 might fix the problem, but I could not select that in setup.exe. I also tried

peflags -x8192000 `which ruby`

which did not help. I also tried 18192000. I uninstalled Ruby and re-installed. Same with rails. It only fails when it's inside of an app directory. When I try

rails new testapp

It creates the directory and files, but fails on bundle install . I can't run rails -v in that directory either. I suspect there are other commands that will fail too, but I haven't found them yet. I'm using Windows XP SP3.

$ uname -a
CYGWIN_NT-5.1 dumbopc 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin

Here are the bad lines if you are curious

$ rails -v
/usr/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:114: stack level too 
deep (SystemStackError)
$ cat -n /usr/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb | grep '^ *114'
   114      requirements.map { |op, version| "#{op} #{version}" }.sort
$ bundle install
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb:32: 
stack level too deep (SystemStackError)
$ cat -n /usr/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb |  grep '^ *32'
    32        raise e

I also tried all the suggestions from bundler following its link. I added -d to the rails script and it printed this:

$ rails -v
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems.rb:1264 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems.rb:1273 - cannot load such file -- rubygems/defaults/ruby
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=0.9.2.2>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=10.0.3>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.5>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.6>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=0.9.2.2>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=10.0.3>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.5>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.6>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=0.9.2.2>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=10.0.3>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.5>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.6>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=0.9.2.2>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=10.0.3>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.5>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.6>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=0.9.2.2>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=10.0.3>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.5>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.6>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=0.9.2.2>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=rake version=10.0.3>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.5>
Exception `NoMethodError' at /usr/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1495 - undefined method `to_ary' for #<Gem::Specification name=json version=1.7.6>
/usr/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:118: stack level too deep (SystemStackError)


$ head -1 /usr/bin/rails
#!/usr/bin/ruby.exe -d

I think your peflags command line is wrong. Try:

peflags -X409600 `which ruby`

as described here .

Same thing happened to me. I uninstalled ruby from the cygwin setup file, and when I ram ruby -v in CMD, it was still there!

Turns out, I have other instances of ruby.exe in the "PATH" environment variables. So check your environment variables, uninstall everything and see if there is another ruby file it is pointing to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM