I run gulp in my console I got this error:
Task 'default' is not in your gulpfile
My gulpfile looks just fine:
var gulp = require('gulp'), LiveServer = require('gulp-live-server'), browserSync = require('browser-sync'); gulp.task('live-server', function () { var server = new LiveServer('server/main.js'); server.start(); }); gulp.task('serve', ['live-server'], function () { browserSync.init(null, { proxy: "http://localhost:3000", port: 9001 }); });
Run a Gulp Task in Visual Studio CodeType "Run Task" and select it, which will bring up a list of tasks configured in Gulp. Choose the Gulp Task you want to run! Most of your Gulp Tasks will probably be automated using gulp watch, but manual Gulp Tasks can easily be run within Visual Studio Code.
A gulpfile is a file in your project directory titled gulpfile. js (or capitalized as Gulpfile. js , like Makefile), that automatically loads when you run the gulp command.
Writing the First Gulp Task. All Gulp configuration goes in a file called gulpfile. js located at the root of the project. The pattern for writing tasks is that you first load a plugin you're about to use and then define a task that is based on that plugin.
When you just run gulp
in your console it will look for a default task to run. You only defined live-server
and serve
as tasks.
To solve define a default task, you can add the task you actually want to run as the dependency like so:
gulp.task( 'default', [ 'serve' ] )
Now if you run gulp
it will run the default
task which in turn runs the serve
task. Alternatively you can just run gulp serve
and it will work as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With