Why is gulp compass throwing out TypeError: dest.on is not a function in my Windows 7 environment
Why is gulp compass throwing out TypeError: dest.on is not a function in my Windows 7 environment
我在 Visual Studio、Windows 的项目根目录中安装了 gulp 和一些其他包 7. 我发现每当我 运行命令 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)
这是我的 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']);
非常感谢对此的任何帮助。谢谢,
您需要安装并要求 gulp-compass
,而不是 compass
。
我在 Visual Studio、Windows 的项目根目录中安装了 gulp 和一些其他包 7. 我发现每当我 运行命令 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)
这是我的 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']);
非常感谢对此的任何帮助。谢谢,
您需要安装并要求 gulp-compass
,而不是 compass
。