“stack level too deep” while compiling assets

2019-06-21 20:16发布

问题:

After running brew upgrade, or something else which updated my gems/ruby version, my rake assets:precompile task no longer works.

I get this error:

rake aborted!
stack level too deep
  (in /Users/Jordan/Development/reejay/rails/reejay/app/assets/stylesheets/blog_player.css.scss)
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby /...]
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils.rb:80:in `ruby'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `ruby'
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/Jordan/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/local/bin/rake:32:in `<main>'
Tasks: TOP => assets:precompile

Here is a link to my Gemfile: http://www.pastie.org/3019470

Other rake tasks, like db:migrate, continue to work as expected. This only affects the assets:precompile task.

回答1:

(Repeating my comment from above, since it appears to have actually been the correct answer. For anyone who does not already use it: rvm, rvm, rvm. Learn it, love it.)

There's something very strange with a stack trace that references three different versions of ruby (1.9.1, 1.9.2, and 1.9.3). I would recommend installing rvm, creating a clean gemset, and trying this again.



回答2:

This problem is probably caused by not having the latest version of rubygems installed.

If you did this: "gem update --system", it would have worked regardless of you using rvm or not.