gulp-ruby-sass - 'sass' is not recognized as an internal or external command, operable program or batch file

Strauss808 picture Strauss808 · Sep 29, 2015 · Viewed 18.5k times · Source

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.

Answer

Strauss808 picture Strauss808 · Sep 29, 2015

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.