简体   繁体   English

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

[英]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: 我已经在Windows 7的Visual Studio的项目的根目录中安装了gulp和一些其他软件包。我发现,每当运行gulp watch或gulp Compass watch命令时,都会出现以下错误:

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: 这是我的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, 谢谢,

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM