我无法看到工作。它给出了一个以" TypeError:Object function(server)"开头的错误。这是完整的错误(对不起截图):http://cl.ly/image/3p0j1F2L1S0I
这是我的gulp档案:
var gulp = require('gulp'),
// Include plugins
cache = require('gulp-cache'),
gutil = require('gulp-util'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
rename = require('gulp-rename'),
compass = require('gulp-compass'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
imagemin = require('gulp-imagemin'),
livereload = require('gulp-livereload');
// Paths
// ============================================================
// var PATH = 'public_html/assets';
// Error Handling
// ============================================================
var onError = function (err) {
gutil.beep();
console.log( err );
};
// Styles Task
// ============================================================
gulp.task('styles-global', function() {
return gulp.src('assets/scss/app.scss')
.pipe( plumber({ errorHandler: onError }) )
// .pipe(sass({ style: 'compressed' }))
.pipe(compass({
config_file: 'config.rb',
css: 'assets/css',
sass: 'assets/scss',
image: 'assets/img'
}))
// .pipe(rename({suffix: '.min'}))
// .pipe(minifycss())
.pipe(gulp.dest('assets/css'))
.pipe(livereload())
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('styles-base', function() {
return gulp.src('assets/scss/base.scss')
.pipe( plumber({ errorHandler: onError }) )
// .pipe(sass({ style: 'compressed' }))
.pipe(compass({
config_file: 'config.rb',
css: 'assets/css',
sass: 'assets/scss',
image: 'assets/img'
}))
// .pipe(rename({suffix: '.min'}))
// .pipe(minifycss())
.pipe(gulp.dest('assets/css'))
.pipe(livereload())
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('styles-light', function() {
return gulp.src('assets/scss/light.scss')
.pipe( plumber({ errorHandler: onError }) )
// .pipe(sass({ style: 'compressed' }))
.pipe(compass({
config_file: 'config.rb',
css: 'assets/css',
sass: 'assets/scss',
image: 'assets/img'
}))
// .pipe(rename({suffix: '.min'}))
// .pipe(minifycss())
.pipe(gulp.dest('assets/css'))
.pipe(livereload())
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('styles', ['styles-global', 'styles-base', 'styles-light']);
// JS Tasks
// ============================================================
gulp.task('scripts', function() {
return gulp.src([
'assets/js/plugins/jquery.hoverIntent.js',
'assets/js/plugins/fancybox/jquery.fancybox.js',
'assets/js/src/app.js'
])
.pipe( plumber({ errorHandler: onError }) )
.pipe(concat('app.js'))
.pipe(gulp.dest('assets/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('assets/js'))
.pipe(livereload())
.pipe(notify({ message: 'JS task complete' }));
});
// HTML Tasks
// ============================================================
gulp.task('html', function() {
return gulp.src('assets/tpl/**/*.html')
.pipe(livereload());
});
// Default task
// -------------------------------------------------------------------
gulp.task('default', [], function() {
gulp.start('styles', 'scripts');
// gulp.start('styles', 'scripts', 'images');
});
// Watch task
// -------------------------------------------------------------------
gulp.task('watch', function() {
gulp.watch('assets/scss/**/*.scss', ['styles']);
gulp.watch('assets/js/**/*.js', ['scripts']);
livereload.listen();
gulp.watch('assets/tpl/**/*.html', ['html']).on('change', livereload.changed);
});
我不知道如何修复。我正在运行node.js版本0.10.33,gulp版本3.8.8。如果我运行脚本或样式任务,运行正常。只是吞下了失败的手表。
答案 0 :(得分:0)
务必检查gulp -v
,确保它是最新的,然后您可以检查以确保您的包裹是最新的npm outdated --depth=0
- https://docs.npmjs.com/cli/outdated
这应解决问题。