Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

unable to change port #972

Closed
Mattchewone opened this issue Jan 20, 2016 · 4 comments
Closed

unable to change port #972

Mattchewone opened this issue Jan 20, 2016 · 4 comments

Comments

@Mattchewone
Copy link

Hi,

I am using gulp + browsersync + babel, everything seems to be running ok, except when I pass in a custom port number browser-sync does not seem to be using it.

Here is a snippet

import {create as bsCreate} from 'browser-sync';
const browserSync = bsCreate();

gulp.task('browser-sync', () => {
  browserSync.init({
    server: {
      baseDir: "./build",
      port: 8081
    }
  });
});

It just defaults to 3000, to get round this temporarily I have gone in and change the default-config.js but this is not ideal.

Matt

@shakyShane
Copy link
Contributor

port is not a child property of the server option. (I know that's not intuitive, I've addressed this in V3)

change to this and you're good.

import {create as bsCreate} from 'browser-sync';
const browserSync = bsCreate();

gulp.task('browser-sync', () => {
  browserSync.init({
    server: {
      baseDir: "./build"
    },
    port: 8081
  });
});

@chrillewoodz
Copy link

chrillewoodz commented Oct 3, 2016

I use this and it's still defaulting to 3001.

gulp.task('browser-sync', function() {

  browserSync.init({
    port: 3000,
    server: {
      baseDir: './app'
    }
  });
});

@heinhoang
Copy link

I'm meeting same problem

@pratikthakur222
Copy link

I too have the same issue,
Changed port to 9000 but it was showing 9001,
but then when i tried changing my default port in my server file to 9001 , browserSync got it right to 9000
And when my port is set to 9000 in browserSync and then I run my server file it gives Error: listen EADDRINUSE ::: 9000
Which means browserSync is using that address.

I guess browserSync does not allows to use the same port which we are using in our server/app.js file

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants