Node.js 吞咽任务不在您的吞咽文件中

Node.js 吞咽任务不在您的吞咽文件中,node.js,gulp,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('st

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'))
});

有什么问题吗?

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

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

默认情况下,gulp使用
gulp.js
模块,您的任务必须在那里,或者您需要在该模块中加载包含此任务的文件。默认情况下,gulp使用
gulp.js
模块,您的任务必须在那里,或者您需要在该模块中加载包含此任务的文件。