K
K
Kulbabka2018-03-12 01:52:53
gulp.js
Kulbabka, 2018-03-12 01:52:53

BrowserSync autostart not working?

Hello everyone, there was such a thing ((Autorun BrowserSync does not work, what exactly do I mean, addresses are created, everything is fine, but when I try to start BrowserSync it gives me this error.
prntscr.com/ipv7yi but if I enter the address into the browser, then everything is ok. Maybe someone faced such a task? I am attaching the code
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync').create();
gulp .task('sass', function() {
return gulp.src('scss/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(' css'))
.pipe(browserSync.reload({stream: true}))
});
gulp.task('browser-sync',function() {
browserSync.init({
server: {
baseDir: '../',
index: "index.html",
directory: true
}
});
});
gulp.task('watch', ['browser-sync', 'sass'] , function() {
gulp.watch('scss/main.scss', ['sass']);
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Epifanov, 2018-03-12
@kacheleff

did you watch it?

M
MeylisDay, 2018-03-12
@MeylisDay

BaseDir must be a directory.
Here is an example of what my config looks like

var config = {
    server: {
        baseDir: "build/"
    },
    tunnel: true,
    host: 'localhost',
    port: 3000,
    directoryListing: true,
    logPrefix: ''
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question