简体   繁体   English

Ruby:堆栈级别太深(SystemStackError)

[英]Ruby: stack level too deep (SystemStackError)

Ruby is crashing in Cygwin for rails and bundler. Ruby在Cygwin中因使用rails和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. 我尝试了Ruby的两个版本:ruby 1.9.3p327和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. 我从Google找到了一些暗示1.9.2可以解决该问题的信息,但是我无法在setup.exe中选择它。 I also tried 我也试过

peflags -x8192000 `which ruby`

which did not help. 这没有帮助。 I also tried 18192000. I uninstalled Ruby and re-installed. 我还尝试了18192000。我卸载了Ruby,然后重新安装。 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 . 它创建目录和文件,但是在bundle install上失败。 I can't run rails -v in that directory either. 我也不能在该目录中运行rails -v I suspect there are other commands that will fail too, but I haven't found them yet. 我怀疑还有其他命令也会失败,但是我还没有找到它们。 I'm using Windows XP SP3. 我正在使用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. 我还尝试了bundler链接后的所有建议。 I added -d to the rails script and it printed this: 我在-rails脚本中添加了-d,并打印了以下内容:

$ 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. 我认为您的peflags命令行错误。 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! 我从cygwin设置文件中卸载了ruby,当我在CMD中打开ruby -v时,它仍然存在!

Turns out, I have other instances of ruby.exe in the "PATH" environment variables. 原来,我在“ PATH”环境变量中还有ruby.exe的其他实例。 So check your environment variables, uninstall everything and see if there is another ruby file it is pointing to. 因此,请检查您的环境变量,卸载所有内容,然后查看它是否指向另一个ruby文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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