11

I'm trying to run gulp-ruby-sass on Windows.

I've already installed Ruby and Sass like that: $ gem install sass

My gulp.task looks like this:

gulp.task('styles', function() {
   return sass('src/scss/**/*.scss')
     .on('error', sass.logError)
     .pipe(gulp.dest('css'));
});

When I cd into the root directory of my project and run $ gulp styles, I get this:

[22:54:52] Using gulpfile c:\wamp\www\wordpress\
wp-content\themes\bootscores\gulpfile.js
[22:54:52] Starting 'styles'...
[22:54:52] 'sass' is not recognized as an internal or external command,
operable program or batch file.
Error in plugin 'gulp-ruby-sass'
Message:
    Gem undefined is not installed.
[22:54:52] Finished 'styles' after 89 ms

I've been searching for a solution to this problem for about two hours now and still haven't found one that would help me.

Strauss808
  • 221
  • 1
  • 2
  • 6

3 Answers3

11

I've finally found a solution.

I had to manually add a path to my Ruby bin folder in Control Panel > System > Advanced > Environment Variables. Here i added a new variable named path with a path to my Ruby bin folder (C:\Ruby22-x64\bin).

Then I restarted my Node.js command prompt and got the output I was looking for.

Thank you, CDF, for you answer and effort! Even though I answered this question myself, I hope it will eventually help other people too.

Strauss808
  • 221
  • 1
  • 2
  • 6
  • I was trying to solve it on my side and I cannot get this error :) I upvote your own reply – CDF Sep 29 '15 at 21:30
  • 1
    @ZachSaucier Yes, finally I got this working! **Restarting the command prompt** as the answer says was my issue. – woz Nov 10 '16 at 01:20
  • I installed sass https://rubyinstaller.org/downloads/ and had the environment variable in place as well like `PATH=C:\Ruby23\bin;%PATH%`. The issue in my case was to also run `npm install -g gulp-ruby-sass`. – learning... Apr 02 '19 at 16:46
10

I had the same error, only in my situation sass package wasn't installed in RubyGem.

You need to execute following command:

gem install sass
rnofenko
  • 9,198
  • 2
  • 46
  • 56
4

INSTALL RUBY

Use the Ruby installer and reinstall it. Then check the path checkbox. It should be resolved then.

  1. Install Sass Using the Command Prompt

    [CMD] + [R] type cmd hit [ENTER]

    Type gem install sass

If you get an error message then it's likely you will need to use the sudo command to install the Sass gem. It would look like:

sudo gem install sass

4 Reboot the NODE command line. In fact you might want to reboot the system, most users do not do enough of that.

user3806549
  • 1,428
  • 1
  • 17
  • 25