Dave Dave - 2 months ago 6x
CSS Question

Getting "undefined method `this' for #<Gem::Specification:0x3fcd454385e4 compass-1.0.3> (NoMethodError)" when running "compass compile"

I’m using Rails 4.2.3. I’m trying to get this import to work in my “app/assets/stylesheets/profile.css.scss” file

@import "compass/css3";

but I read that I have to install the compass gem and then compile things. So after installing the gem, I ran this command

davea$ compass compile
/Users/davea/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification:0x3fcd454385e4 compass-1.0.3> (NoMethodError)
from /Users/davea/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
from /Users/davea/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/compass-1.0.3/bin/compass:20:in `block in <top (required)>'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/compass-1.0.3/bin/compass:8:in `fallback_load_path'
from /Users/davea/.rvm/gems/ruby-2.3.0/gems/compass-1.0.3/bin/compass:19:in `<top (required)>'
from /Users/davea/.rvm/gems/ruby-2.3.0/bin/compass:23:in `load'
from /Users/davea/.rvm/gems/ruby-2.3.0/bin/compass:23:in `<main>'
from /Users/davea/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/davea/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Per reading documentation, I was told I had to create a “config.rb” file, which I did in my project root directory, containing this

css_dir = "css"
sass_dir = "sass"

but even still I get the above error.


YOu don't need to compile anything to get that import to work. Add this to your Gemfile

gem 'compass-rails'


bundle install

and restart your server and you'll be able to do the import.