Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Not specifing localIdentifier fails with another process running error #99

Open
adriaandotcom opened this issue Feb 3, 2020 · 3 comments

Comments

@adriaandotcom
Copy link

adriaandotcom commented Feb 3, 2020

When starting the app (see example below) without localIdentifier is fails to load:

const bs_local_args = {
  key: "***",
  // localIdentifier: "testing"
}

Expected Behavior

It just loads.

Actual Behavior

It fails with LocalError: Either another browserstack local client is running on your machine or some server is listening on port 45691
Error: LocalError: Either another browserstack local client is running on your machine or some server is listening on port 45691
    at /Users/Adriaan/node_modules/browserstack-local/lib/Local.js:65:20
    at ChildProcess.exithandler (child_process.js:286:7)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  name: 'LocalError',
  message: 'Either another browserstack local client is running on your machine or some server is listening on port 45691',
  extra: undefined

Platform details

  1. browserstack-local-nodejs version: 1.4.5
  2. node version: 12.14.0
  3. os type and version: mac os x Catalina

Details

This is a minimal version of the bug:

const browserstack = require("browserstack-local");
const url = require("url");
const http = require("http");
const PORT = 8080;

(async () => {
  http
    .createServer(req => {
      const { pathname } = url.parse(req.url);
      console.log("Request:", pathname);
    })
    .listen(PORT, () => {
      console.log("Started node server");
    });

  const bs_local = new browserstack.Local();

  const bs_local_args = {
    key: "***",
    // localIdentifier: "testing"
  };

  bs_local.start(bs_local_args, function(error) {
    if (error) return console.error("Error:", error);
    console.log("Running BrowserStackLocal", bs_local.isRunning());
    bs_local.stop(function() {
      console.log("Stopped BrowserStackLocal");
    });
  });
})();
@readikus
Copy link

readikus commented Feb 5, 2020

Similar issue - force no longer seems to be effective at killing existing local connections.

@RohanImmanuel
Copy link

Hi @adriaanvanrossum

Browserstack Local allows for only one instance of the binary(without local identifier). This includes any instance run by you using the terminal, language bindings or processes running in the background.

If you have run local tests via language bindings in the past, an instance may be running in the background if the driver process failed to quit.

If you have BrowserStack's Local app installed on your system, you will be required to uninstall the app and preferably restart before running the Local Binary.

@RohanImmanuel
Copy link

@readikus the force parameter would only kill binary instances with the same local identifier and hence it won't work on binary instances that are initialized without a local identifier

ref: https://www.browserstack.com/local-testing/binary-params

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

No branches or pull requests

3 participants