Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 908
Strauss808 Avatar asked Sep 29 '15 21:09

Strauss808


3 Answers

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
like image 172
rnofenko Avatar answered Oct 23 '22 19:10

rnofenko


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.

like image 29
user3806549 Avatar answered Oct 23 '22 18:10

user3806549


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.

like image 34
Strauss808 Avatar answered Oct 23 '22 19:10

Strauss808