gulp任务不在你的gulpfile中

时间:2017-08-20 09:05:07

标签: node.js gulp

node.js的新手,尝试使用gulp。我收到了这个错误:

Task 'styles' is not in your gulpfile

我看到这是一个非常常见的错误,是什么原因造成的? 这是我的代码。

auto-prefixer和gulp都在我的package.json文件

文件名为autoprefixer.js

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


gulp.task('styles',function(){
    return gulp.src('css/style.css')
    .pipe(autoprefixer())
    .pipe(gulp.dest('build'))
});

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

我发现了我的问题...文件名是autoprefixer.js而不是gulpfile.js。一旦我更改了文件名,一切都很顺利。

相关问题