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

折月煮酒 提交于 2019-12-23 09:04:11

问题


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

回答1:


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



回答2:


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.




回答3:


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


来源:https://stackoverflow.com/questions/45269621/phusion-error-undefined-method-has-for-sassutilmodule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!