Answer the question
In order to leave comments, you need to log in
What is it and what to do with it?
Tell me, please, how to fix it?
[Browsersync] 1 file changed (main.min.js)
[20:09:04] Finished 'scripts' after 2.8 s
[20:09:04] 'browsersync' errored after 2.87 s
[20:09:04] Error: listen EADDRINUSE: address already in use :::3005
at Server.setupListenHandle [as _listen2] (net.js:1313:16)
at listenInCluster (net.js:1361:12)
at Server.listen (net.js:1447: 7)
at module.exports.plugin (C:\Users\user\Desktop\mavik\node_modules\browser-sync\dist\server\index.js:27:25)
at Object.startServer [as fn] (C:\ Users\user\Desktop\mavik\node_modules\browser-sync\dist\async.js:179:52)
at C:\Users\user\Desktop\mavik\node_modules\browser-sync\dist\browser-sync.js: 120:14
at iterate (C:\Users\user\Desktop\mavik\node_modules\browser-sync\dist\utils.js:268:9)
at C:\Users\user\Desktop\mavik\node_modules\browser-sync\dist\ utils.js:279:21
at executeTask (C:\Users\user\Desktop\mavik\node_modules\browser-sync\dist\browser-sync.js:136:13)
at Object.mergeMiddlewares [as fn] (C: \Users\user\Desktop\mavik\node_modules\browser-sync\dist\async.js:168:9)
[20:09:04] 'default' errored after 2.88 s
const { src, dest, watch, parallel } = require('gulp');
const scss = require('gulp-sass');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
const uglify = require('gulp-uglify');
const browserSync = require('browser-sync').create();
const imagemin = require('gulp-imagemin');
function browsersync() {
browserSync.init({
server: {
baseDir: 'app/'
}
})
}
function styles() {
return src('app/scss/style.scss')
.pipe(scss({ outputStyle: 'compressed' }))
.pipe(concat('style.min.css'))
.pipe(autoprefixer({
overrideBrowserslist: ['last 10 versions'],
grid: true
}))
.pipe(dest('app/css'))
.pipe(browserSync.stream())
}
function images() {
return src('app/images/**/*.*')
.pipe(imagemin([
imagemin.gifsicle({ interlaced: true }),
imagemin.mozjpeg({ quality: 75, progressive: true }),
imagemin.optipng({ optimizationLevel: 5 }),
imagemin.svgo({
plugins: [
{ removeViewBox: true },
{ cleanupIDs: false }
]
})
]))
.pipe(dest('dist/images'))
}
function scripts() {
return src([
'node_modules/jquery/dist/jquery.js',
'app/js/main.js'
])
.pipe(concat('main.min.js'))
.pipe(uglify())
.pipe(dest('app/js'))
.pipe(browserSync.stream())
}
function build(){
return src([
'app/**/*.html',
'app/css/style.min.css',
'app/js/main.min.js',
], {base:'app'})
.pipe(dest('dist'))
}
function watching() {
watch(['app/scss/**/*.scss'], styles);
watch(['app/js/**/*.js', '!app/js/main.min.js'], scripts);
watch(['app/*.html'], done => {
browserSync.reload();
done();
});
}
exports.build = build;
exports.styles = styles;
exports.scripts = scripts;
exports.browsersync = browsersync;
exports.watching = watching;
exports.images = images;
exports.default = parallel(styles, scripts, browsersync, watching);
Answer the question
In order to leave comments, you need to log in
Writes that the address is already in use.
Simply put, you are trying to run browsersync a second time without terminating 1 process.
You may have already run it through another terminal.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question