当前位置: 动力学知识库 > 问答 > 编程问答 >

node.js - Why is gulp compass throwing out TypeError: dest.on is not a function in my Windows 7 environment

问题描述:

I have installed gulp and some other packages in the root directory of my project in Visual Studio, Windows 7. I'm find that whenever I run the command gulp watch or gulp compass watch I get the following error:

C:\MyProject>gulp compass watch

[11:03:53] Using gulpfile C:\MyProject\gulpfile.js

[11:03:53] Starting 'compass'...

[11:03:53] 'compass' errored after 6.09 ms

[11:03:53] TypeError: dest.on is not a function

at DestroyableTransform.Readable.pipe (C:\MyProject\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\no

de_modules\readable-stream\lib\_stream_readable.js:516:8)

at Gulp.<anonymous> (C:\MyProject\gulpfile.js:23:10)

at module.exports (C:\MyProject\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)

at Gulp.Orchestrator._runTask (C:\MyProject\node_modules\gulp\node_modules\orchestrator\index.js:273:3)

at Gulp.Orchestrator._runStep (C:\MyProject\node_modules\gulp\node_modules\orchestrator\index.js:214:10)

at Gulp.Orchestrator.start (C:\MyProject\node_modules\gulp\node_modules\orchestrator\index.js:134:8)

at C:\Users\username\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:

20

at doNTCallback0 (node.js:417:9)

at process._tickCallback (node.js:346:13)

at Function.Module.runMain (module.js:469:11)

Here is my gulpfile.js:

// Include Our Plugins

var gulp = require('gulp');

var sass = require('sass');

var compass = require('compass');

var rename = require('gulp-rename');

var config = {

bootstrapDir: 'node-modules/bootstrap-sass',

publicDir: 'Content',

};

// Pipe boostrap-sass to main css directory

gulp.task('css', function() {

gulp.src('Content/scss/bootstrap-app.scss')

.pipe(sass({

includePaths: [config.bootstrapDir + '/assets/stylesheets'],

}))

.pipe(gulp.dest(config.publicDir + '/css'));

});

// Compile with Compass

gulp.task('compass', function() {

return gulp.src('Content/scss/*.scss')

.pipe(compass({

// config_file: 'node_modules/compass/test/config.rb',

css: 'css',

sass: 'scss'

}))

.pipe(gulp.dest('Content/css'));

});

// Watch Files For Changes

gulp.task('watch', function() {

gulp.watch('Content/scss/*.scss', ['compass']);

});

// Default Task

gulp.task('default', ['compass', 'watch']);

Any help on this much appreciated. Thanks,

网友答案:

You need to install and require gulp-compass, not compass.

分享给朋友:
您可能感兴趣的文章:
随机阅读: