gulp-compass asking for Ruby and Compass in PATH when they are already there

1.2k Views Asked by At

I'm trying to get gulp-compass to work on my Debian linux but am getting an error message stating that Ruby and Compass must be in the path. I am a bit of a beginner when it comes to Gulp so is probably me being stupid.

The following is the exact error message I get when running the task I create in my Gulpfile:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: You need to have Ruby and Compass installed and in your system PATH for this task to work.

Process finished with exit code 1

I've looked through other similar questions that suggest doing a gem install compass and a gem install sass but neither seem to work for me.

My Gulpfile is as follows:

var gulp = require('gulp'),
compass = require('gulp-compass');

gulp.task('stylesheets', function(){
    return gulp.src('**/*.scss')
        .pipe(compass({
            config_file: './config.rb',
            css: 'css',
            sass: 'sass'
        }))
        .pipe(gulp.dest('css'));
});

I can runruby -v and compass -v I can see that these are correctly in my path and doing an echo $PATH shows that ruby is definitely there.

I am wondering if it is a problem to do with me installing ruby with RVM or the fact that I am using Bundler to install the gems in my project. My Gemfile is as follows:

source 'https://rubygems.org'
gem 'susy'
gem 'compass'
gem 'breakpoint'

I have installed the gems with bundle install and have also tried the bundle_exec: true option in gulp-compass (though truth be told I don't really know what this is for not being a Bundler expert). I have tried re-installing Ruby.

Has anyone any idea as to why I am getting the above error message? I've never had errors like this when doing similar with Grunt.

1

There are 1 best solutions below

0
On

I've finally managed to get round this. I uninstalled RVM with rvm implode and then installed Ruby again with a regular apt-get install ruby.

Once I did this it all worked fine. I had to make a minor tweak to my gulpfile so it is now:

var gulp = require('gulp'),
compass = require('gulp-compass');

gulp.task('stylesheets', function(){
    console.log();
    return gulp.src('sass/**/*.scss')
        .pipe(compass({
            config_file: './config.rb',
            css: 'css',
            sass: 'sass'
        }))
        .pipe(gulp.dest('css'));
});

This isn't exactly an ideal as I'm now stuck with an older version of Ruby (ruby 2.1.5p273) when the current stable release (at time of writing) is 2.2.2. I'd rather use RVM but this will do for now.