Fixing annoying asset/compass/sass error after Rails 4.0.4 upgrade

on under developer
1 minute read

Out Of Date Warning

This article was published on 01/04/2014, this means the content may be out of date or no longer relevant.
You should verify that the technical information in this article is still up to date before relying upon it for your own purposes.

TLDR: lock sprockets to 2.11.0 or sass-rails to 4.0.2

After upgrading our Rails 4 apps to the latest minor release, I got this error every single time:

ArgumentError - wrong number of arguments (2 for 1)
  (in /profiles/swi/Projects/portal/app/assets/stylesheets/style.css.sass):
  sprockets (2.12.0) lib/sprockets/sass_importer.rb:11:in `initialize'
  compass-rails (1.1.6) lib/compass-rails/patches/sass_importer.rb:7:in `block in evaluate'
  compass-rails (1.1.6) lib/compass-rails/patches/sass_importer.rb:7:in `evaluate'
  () profiles/swi/.rvm/gems/ruby-2.0.0-p195@global/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
  sprockets (2.12.0) lib/sprockets/context.rb:197:in `block in evaluate'
  sprockets (2.12.0) lib/sprockets/context.rb:194:in `evaluate'
  sprockets (2.12.0) lib/sprockets/processed_asset.rb:12:in `initialize'
  sprockets (2.12.0) lib/sprockets/base.rb:374:in `block in build_asset'
  sprockets (2.12.0) lib/sprockets/base.rb:395:in `circular_call_protection'
  sprockets (2.12.0) lib/sprockets/base.rb:373:in `build_asset'

At first, looking into the referenced stylesheet, I could not find anything wrong, so I upgraded several gems. I got it working with this configuration:

gem 'compass-rails', "~> 1.1.6" # not relevant for this case,
gem 'sass-rails', '4.0.2'
gem 'sprockets', '~>2.11.0'

Some people already reported this issue on the Sprockets issue tracker.