Answer the question
In order to leave comments, you need to log in
Running GULP why error?
Hello everyone, I copied the following code from the site documentation https://www.browsersync.io SASS + CSS Injecting:
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: "src/"
});
gulp.watch("src/sass/*.sass", ['sass']);
gulp.watch("src/*.html").on('change', browserSync.reload);
});
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src("src/sass/*.sass")
.pipe(sass())
.pipe(gulp.dest("src/css"))
.pipe(browserSync.stream());
});
gulp.task('default', ['serve']);
gulp
, I get an error:PS C:\Users\Qwerty\Desktop\web\project> gulp
assert.js:350
throw err;
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (C:\Users\Qwerty\Desktop\web\project\node_modules\undertaker\lib\set-task.js:10:3)
at Gulp.task (C:\Users\Qwerty\Desktop\web\project\node_modules\undertaker\lib\task.js:13:8)
at Object. (C:\Users\Qwerty\Desktop\web\project\gulpfile.js:6:6)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12 )
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers .js:22:18)
PS C:\Users\Qwerty\Desktop\web\project>
Answer the question
In order to leave comments, you need to log in
You have locally installed Gulp version 4, and the tasks are written for Gulp 3.
In the fourth version, a syntax has appeared that allows you to specify the order in which tasks are run. You can also run tasks in parallel using gulp.parallel. See here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question