Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phusion error: undefined method `has?' for Sass::Util:Module

I get the following error issued by Phusion when loading a web page:

There was an error while trying to load the gem 'compass-rails'.
Gem Load Error is: undefined method `has?' for Sass::Util:Module
Did you mean?  hash
               Hash
Backtrace for gem load error is:
/Volumes/Data/htdocs/zetcho/vendor/bundle/gems/compass-0.12.2/lib/compass/sass_extensions/functions/urls.rb:5:in `has?'

The code at the indicated location is:

module Compass::SassExtensions::Functions::Urls


def self.has?(base, instance_method)
  Sass::Util.has?(:instance_method, base, instance_method)
end

My gem file contains:

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.2'

# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'

# Use Compass for stylesheets
gem 'compass-rails'

# Use the Compass extension susy
gem "sprockets"
gem 'susy'

I've just created the Ruby on Rails site using Rails 5.1.2 and ruby 2.3.1. I have a much older site that works fine with the gem. Did I miss a step in the overall install or is this a bug with compass-rails?

I got the same error when I tried to add a controller:

rails generate controller home index
like image 954
curt Avatar asked Jul 23 '17 20:07

curt


3 Answers

After more digging around, I found a similar problem. I fixed this one by changing the gem file to:

gem 'compass-rails', github: 'Compass/compass-rails'

Then:

rm gemfile.lock
bundle
like image 122
curt Avatar answered Nov 12 '22 16:11

curt


It seems that the issue can be found in compass-rails 2.0.0. The version 3.0.2 seems to fix this issues. So a possible solution is :

# Gemfile
gem 'compass-rails', '~> 3.0.2'

Then bundle update compass-rails

This avoids targeting the compass-rails git master branch in favor of an actual release.

like image 41
Vala Avatar answered Nov 12 '22 16:11

Vala


I came here having the same issue with a grunt compiling issue trying to use Compass/Sass, if this might help someone, my issue was caused because I had an updated version of Sass (sass-3.7.4) that was higher that the max-version compatible with compass, I uninstalled sass:

gem uninstall sass

Which in turn uninstalled compass, and reinstalled compass letting it choose the right version, and problem solved.

gem install compass
like image 1
Iván Gabriel Campaña Naranjo Avatar answered Nov 12 '22 16:11

Iván Gabriel Campaña Naranjo