browserstack / browserstack-local-nodejs

NodeJS bindings for BrowserStack Local
https://www.browserstack.com
MIT License
71 stars 56 forks source link

The binary found in ~/.browserstack is of size 0KB #27

Closed shanep2300 closed 7 years ago

shanep2300 commented 7 years ago

This is after deleting the binary and re-initiating the test script to try and get a fresh binary.

Using version 1.3.0 on Windows 7.

pulkitsharma07 commented 7 years ago

Are you still facing after this https://github.com/browserstack/browserstack-local-nodejs/issues/28 ?

shanep2300 commented 7 years ago

Yes, as I would rather use the default one rather than a defined path.

vedharish commented 7 years ago

Hey @shanep2300, I think this might be because of a failed download. Did you check/get some error object in the callback to start?

bs_local.start(bs_local_args, function(error) {
  console.log("Error:", error);
});

Also, a 0kb file in that particular path should not be an issue as this module re-downloads the binary if it cannot start the binary / the binary is corrupted. So the 0kb file should be fixed on re-downloading (or cough-up a LocalError object if it fails to do so)

shanep2300 commented 7 years ago

Hello @vedharish, This is how it's set up:

console.log("Connecting local");
exports.bs_local = new browserstack.Local();
exports.bs_local.start({
    'key': exports.config.multiCapabilities['browserstack.key'],
    'localIdentifier': exports.config.multiCapabilities['browserstack.localIdentifier']}, function(error) {
  if (error) return reject(error);
  console.log('Connected. Now testing...');

  resolve();
});

This is the error I'm getting:

Error: spawn UNKNOWN
    at exports._errnoException (util.js:1022:11)
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:380:9)
    at Object.exports.execFile (child_process.js:143:15)
shanep2300 commented 7 years ago

Ashwin, from BrowserStack support, helped me fix the spawn issue. Well half of it. The path to the binary needed the .exe. os.homedir() +'/binaries/BrowserStackLocal.exe'. If it didn't have the .exe it would cause another spawn issue. I thought the path just had to point to the folder where the binary was located.

The other half of the problem still hasn't been fixed. I can't get this to work without the binary path defined.

shanep2300 commented 7 years ago

Found a better solution for the path.

var path = require('path');
'binarypath': path.resolve(process.cwd()) + '/binaries/BrowserStackLocal.exe'

This will point the path to the working directory instead of the home directory.