I am having issues creating a nodemon + browserSync via gulp task. I have searched online for a possible solution. I looked on StackOverflow site, but I still have not found any success to a solution for my issue. I am running into this issue
events.js:167
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
I am not sure why when I execute gulp
in command line I get this error EADDRINUSE :::3000
. I have checked the port using netstat -ano | findStr "9000"
the port isn't being called by another process. I am not sure why I run into this issue when I execute my gulp task. Can someone please provide some guidance? I will greatly appreciate I am running out of options.
gulpfile.js
gulp.task('nodemon', function (cb) {
var called = false;
return nodemon({
script: './server.js',
ignore: [
'../server/gulpfile',
'../server/server.js',
'../server/node_modules/'
],
}).on('start', function () {
if (!called) {
cb();
called = true;
}
}).on('restart', function () {
setTimeout(function () {
reload({ stream: false });
}, 1000);
});
});
gulp.task('browser-sync', ['nodemon'], function() {
browserSync.init({
proxy: 'http://localhost:9000',
open: false,
browser:'google-chrome',
port: 9000,
notify: true
});
});
// Static Server + watching scss/hbs files
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: "./client"
});
gulp.watch(['node_modules/**/*.scss', '../client/**/*.scss'], ['sass']);
gulp.watch("client/views/partials/*.hbs").on('change', browserSync.reload);
});
gulp.task('default', ['js','serve', 'browser-sync']);
folder Structure folder structure image