18

My website used to be working and Heroku precompiled the assets and everything. Now, seemingly out of nowhere, I started to get this message on deploy:

Preparing app for Rails asset pipeline
Running: rake assets:precompile
mkdir -p /tmp/build_31cexir1p9pwn/public/assets
mkdir -p /tmp/build_31cexir1p9pwn/public/assets/icons
mkdir -p /tmp/build_31cexir1p9pwn/public/assets/icons
mkdir -p /tmp/build_31cexir1p9pwn/public/assets
mkdir -p /tmp/build_31cexir1p9pwn/public/assets
(in /tmp/build_31cexir1p9pwn)
mkdir -p /tmp/build_31cexir1p9pwn/public/assets
mkdir -p /tmp/build_31cexir1p9pwn/public/assets
rake aborted!
stack level too deep
(in /tmp/build_31cexir1p9pwn/app/assets/stylesheets/theme.css.scss)

(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation

It can't precompile my css file.

I'm using cedar stack and this is my gemfile:

gem 'rails', '3.1.0'
gem 'rake', '0.8.7'
gem 'devise'

group :production do
  gem 'pg'
  gem 'thin'
end

group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

Here's my application.rb file

# Enable the asset pipeline
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'

And here's my production.rb file

# Code is not reloaded between requests
config.cache_classes = true

# Full error reports are disabled and caching is turned on
config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

# Enable Rails's static asset server (Apache or nginx will not need this)
config.serve_static_assets = true

# Set expire header of 30 days for static files
config.static_cache_control = "public, max-age=2592000"

# Allow JavaScript and CSS compression
config.assets.compress = true

# Compress JavaScript by removing whitespace, shortening variable names, ...
config.assets.js_compressor = :uglifier

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

Now all my links to images are broken (I'm using image-url() in my css file). What could be the problem and how do I fix it?

Ashitaka
  • 19,028
  • 6
  • 54
  • 69
  • would you be able to list this file, theme.css.scss. It seems overflow with your asset pipeline – Ben Zhang Mar 20 '12 at 00:35
  • 1
    The "stack level too deep" error is, in effect, a case of the application running out of memory. It's often a result of programs that use a lot of recursion (functions that call themselves), and things like parsers (SASS to CSS, CoffeeScript to JS, ERB to HTML) would typically use recursion. As a work-around, try pre-compiling the assets before deploying -- you may have more memory on your local machine than the Heroku instance. – Tom Harrison Mar 20 '12 at 01:05
  • This is a pretty serious bug. Did you report it on github? – jcollum Apr 24 '12 at 05:56
  • It had already been reported. That's where the answer was. https://github.com/rails/sass-rails/issues/78 – Ashitaka Apr 26 '12 at 13:28

3 Answers3

30

I was truly desperate so I asked another question. Apparently this is caused by sass and downgrading to sass-rails v3.1.4 v3.2.5 will make it work.

Community
  • 1
  • 1
Ashitaka
  • 19,028
  • 6
  • 54
  • 69
1

upgrading to sass v3.2.12 did the trick for me

but overall, it looks like the issue is fixed on all current versions, just do a bundle update and you should be good.

spyd3rr
  • 2,745
  • 2
  • 16
  • 14
1

For ruby 2.3.0 or lower versions are having the following line in application.rb file for Rails. But 2.4.0 or higher have implemented those as automated.

Bundler.require(*Rails.groups)

Changing the ruby version to 2.3.0 did the trick. This one saved my day.

Kumar KS
  • 873
  • 10
  • 21