Why does “compass watch” say it cannot load sass/script/node (LoadError)?

核能气质少年 提交于 2019-11-27 11:16:52

Uninstall sass and reinstall it with the following:

gem uninstall sass
gem install sass

There was an issue with my installation of sass and doing this fixed the issue.

In my case, Sass version was not compatible with Compass.

FIX :

  1. uninstall Sass AND Compass

    gem uninstall compass
    gem uninstall sass
    
  2. install Compass who will install a compatible Sass engine automaticaly

    gem install compass
    

This combination is finally working for me to bring Compass and SASS Sourcemaps together:

Gemfile

gem 'sass', '3.3.0.alpha.149'
gem 'compass', '0.12.2'
gem 'compass-sourcemaps', "~> 0.12.2.sourcemaps.57a186c"

Compass config.rb

sass_options = {:sourcemap => true}

This specific version works well on both:

gem 'sass', '3.3.0.alpha.149'
gem 'compass', '0.12.2'

They might not be compatible with each other that's why you're getting those errors (considering you're using a bleeding edge version).

In case you are using Ubuntu it may be a problem with apt-get and rvm colliding.

Try removing rvm with rvm implode and then run

sudo apt-get install ruby-compass 

compass watch worked for me after that.

A variation on the above answers: for me (using Bootstrap for Sass), it turned out to be

gem install bootstrap-sass

that was needed in order to fix this problem. For me, the LoadError problem with Compass started after I updated the version of Ruby I was using.

I believe this is due to versioning conflicts with sass.

https://rubygems.org/gems/compass gem is currently at v0.12.16 currently - add this to Gemfile

gem 'sass', '3.2.19'
gem 'compass', '0.12.6'

You may be required to uninstall all versions of both gems first.

I was able to fix it by doing this

gem uninstall sass
gem install sass -v 3.2.12

This is definitely due to a version dependency issue, you are better off fixing your grunt task to make it forward compatible with the newer versions of saas, compass and so on.

Sérgio

I had the same problem and then I realised that I had two compass versions, so by doing:

compass watch or compass compile

The compiler didn't know which compass version it should use to compile. So, what you can do is explicitly indicate the compass version to work with:

compass _1.0.3_ watch

There's another interesting thread.

The following combinations worked for me:

gem install compass --pre
gem install sass -v 3.3.3

I had to setup a gemfile with the correct versions (this error is caused by mismatched SASS and Compass versions, for me). I used thew following with bundle install to fix the problem:

source "https://rubygems.org"

gem 'bootstrap-sass', "~> 3.2.0"
gem 'sass', [ "< 3.5" , ">= 3.3.13" ]
gem 'compass', "~> 1.0.1"
gem 'compass-core', "~> 1.0.1"
gem 'compass-import-once', "~> 1.0.5"
gem 'chunky_png', "~> 1.2"
gem 'rb-fsevent', ">= 0.9.3"
gem 'rb-inotify', ">= 0.9"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!