S
S
spone3792017-09-29 18:56:11
gulp.js
spone379, 2017-09-29 18:56:11

Why doesn't browser-sync open a browser?

When running the gulp browser-sync command, an error is thrown and the browser does not open localhost. You can open it manually, but all the same, changes will only be made when the page is refreshed. I did not find any effective advice on the Internet (badly searched ??).
59ce6c4ce5f4f774446643.jpeg

var gulp          = require('gulp'),           
      browserSync = require('browser-sync');

gulp.task('browser-sync', function() {
    browserSync({
    	server: {
    		baseDir: './app'
    	},
    	notify:false  	
    });
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
spone379, 2017-09-30
@spone379

I don’t know how this is connected, maybe someone will have an explanation, but after an hour of trying, the idea worked to start the terminal without administrator rights)

I
Ilya Serov, 2017-09-29
@JavaIlya

gulp.task('browser-sync', function() {
  browserSync.init({
    server: {
      baseDir: 'assets/app/'
    },
    notify: false
  });
});

Above indicated your task. Perhaps the problem is not in the gallop, but try adding init as I did, and it's already dancing. I forgot to mention, when creating browserSync I also have this line:
browserSync = require('browser-sync').create(),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question