browserstack / browserstack-local-nodejs

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

Error: spawn UNKNOWN - when attempting to use browserstack-local for the first time #33

Open parky128 opened 7 years ago

parky128 commented 7 years ago

I am having issues trying to get browserstack-local to work having followed the documentation.

In my beforeLaunch I have:

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

        resolve();
    });
});

When attempting to run my protractor script, I get the following error:

Connecting local
C:\Users\rparker\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js
:155
                throw e;
                ^

Error: spawn UNKNOWN
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at exports.spawn (child_process.js:378:9)
    at Object.exports.execFile (child_process.js:143:15)
    at C:\Users\rparker\Documents\GitHub\interACT\node_modules\browserstack-loca
l\lib\Local.js:33:34
    at LocalBinary.binaryPath (C:\Users\rparker\Documents\GitHub\interACT\node_m
odules\browserstack-local\lib\LocalBinary.js:83:7)
    at Local.getBinaryPath (C:\Users\rparker\Documents\GitHub\interACT\node_modu
les\browserstack-local\lib\Local.js:228:19)
    at Local.start (C:\Users\rparker\Documents\GitHub\interACT\node_modules\brow
serstack-local\lib\Local.js:28:10)
    at C:\Users\rparker\Documents\GitHub\interACT\test\protractor-ie.conf.js:34:
24
    at beforeLaunch (C:\Users\rparker\Documents\GitHub\interACT\test\protractor-
ie.conf.js:32:12)

I don't think I have missed out any steps.

Looking at the stacktrace and the files it references, I can see it seems to be downloading a browserstack binary, does this happen at the start of each test run?

Thanks

AnkurGel commented 7 years ago

Hi The browserstack binary is downloaded just once. This seems to be issue around binaryPath on Windows. We will check this soon and get back.

Thanks

madjam002 commented 7 years ago

@AnkurGel Any news on this being fixed?

deisterhold commented 7 years ago

I was having this issue too and it turns out the binary would attempt to download, but my proxy blocked the request causing the download to fail. However, even though the download failed, there was a zero byte file created (at '%USERPROFILE%.browserstack\BrowserStackLocal.exe') on disk that prevented the download from being attempted again once I specified the correct proxy settings.

LachlanStuart commented 6 years ago

Even after deleting the .browserstack directory it would just re-download another 0-byte BrowserStackLocal.exe file. I don't have a proxy configured, nor do I have any kind of invasive corporate firewall that could be killing my connection, so I'm not sure why the download failed every time. Manually replacing that 0-byte file with https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal.exe worked.

valgussev commented 5 years ago

If you arrived here and you are using linux alpine it just not supported according to this issue.

jdcskillet commented 4 years ago

If you arrived here and you are using linux alpine it just not supported according to this issue.

I'm currently having this issue as well... and am using alpine. So this is good to know. Any work around people have?

Chiaro-K commented 4 years ago

To whoever has this problem on Windows

Step 1: Delete the folder '%USERPROFILE%.browserstack\ Step 2: Run the command again and when your antivirus pops up, add the BrowserStackLocal.exe to exceptions

--alternate to Step 2-- Deactivate your antivirus and run the command again.

eisenreich commented 3 years ago

In my case it works after updating the version of node/npm and deps to latest, and delete the %USERPROFILE%/.browserstack folder

ravindra237 commented 3 years ago

In my case it is working after deleting the %USERPROFILE%/.browserstack folder

haideralii commented 3 years ago

@ravindra237 where is this folder %USERPROFILE%/.browserstack, in my case I'm not running on browser stack local but on live

ravindra237 commented 3 years ago

@haideralii - For me, I was unable to run browser stack locally. So post deleting the folder, I was able to run successfully in local. But your case is running in browser-stack itself right? If yes, then you should not face this issue. Could you please elaborate more your case.