为什么gulp指南针抛出TypeError:dest.on不是我的Windows 7环境中的函数

时间:2015-11-18 11:14:01

标签: node.js gulp compass

我在Visual Studio,Windows 7中的项目的根目录中安装了gulp和其他一些软件包。我发现每当我运行命令gulp watch或gulp compass watch时,我都会收到以下错误:< / p>

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)

这是我的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']);

对此的任何帮助都非常感谢。谢谢,

1 个答案:

答案 0 :(得分:0)

您需要安装并需要gulp-compass,而不是compass