gulp-ruby-sass not a recognized command in Windows

2019-04-28 04:37发布

I'm trying out gulp for the first time on a Windows Server 2012 VM. I'm normally a Mac user, so I'm a bit new to Windows & Powershell for dev tools like this. I installed Node.js & npm (and nothing else). I created the following basic Gulpfile to compile my Sass:

Gulpfile.js

var gulp = require('gulp'),
    sass = require('gulp-ruby-sass');

gulp.task('styles', function() {
    return gulp.src('Content/sass_new/application.scss')
    .pipe(sass({ style: 'expanded', }))
    .pipe(gulp.dest('Content/css'))
});

gulp.task('watch', function() {
    gulp.watch('Content/sass_new/*', ['styles']);
})

gulp.task('default', ['styles']);

In Windows Powershell, I run the gulp command, and it outputs the following:

[10:02:57] Using gulpfile C:\[path to]\gulpfile.js
[10:02:57] Starting 'styles'...
[10:02:57] gulp-ruby-sass: 'sass' is not recognized as an internal or external command,
operable program or batch file.
[10:02:57] Finished 'styles' after 316 ms
[10:02:57] Starting 'default'...
[10:02:57] Finished 'default' after 15 μs

Am I missing something here? Do I need to install Ruby or Sass? I thought to do that, I'd need a Ruby command prompt and PowerShell wouldn't have access to it. Any guidance is appreciated!

2条回答
The star\"
2楼-- · 2019-04-28 04:54

Download and Install Ruby : http://rubyinstaller.org/ set ruby location to Path Environment Variable restart the command prompt and run gem install sass

That's it.

查看更多
Deceive 欺骗
3楼-- · 2019-04-28 05:06

Yes that's right, you need to install Ruby and Sass to get gulp-ruby-sass working.

Begin by download the Ruby installer depending on your specs at this address. Once installed you supposed to have it on your system and accessible by PowerShell or the simple command line.

After, just run the command

gem install sass

And you're done.

查看更多
登录 后发表回答