browserstack / nightwatch-browserstack

Selenium examples for Nightwatch and BrowserStack Automate
https://www.browserstack.com
77 stars 63 forks source link

Exception while running local test on Windows #27

Open ckzgraphics opened 5 years ago

ckzgraphics commented 5 years ago

:red_circle: Error-

{{ Connecting local
C:\Users\<User>\Documents\nightwatch-browserstack\scripts\local.runner.js:14
if (error) throw error;
^
LocalError
at C:\Users\<User>\Documents\nightwatch-browserstack\node_modules\browserstack-local\lib\Local.js:58:20
at ChildProcess.exithandler (child_process.js:280:7)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5 }}

:o: Steps to reproduce-

  1. Clone the git repo- https://github.com/browserstack/nightwatch-browserstack
  2. Complete the steps mentioned in the README.md file
  3. Execute the command- npm run local

:o: System Details- Windows 10

JohnamLane commented 5 years ago

I had this same issue. On line 14 of local.runner.js, the BROWSERSTACK_ACCESS_KEY is pulled from .env This assumes you are pulling this secret from a local .env file.

I fixed this by adding the dotenv NPM package to my package.json, then adding the following to the top of local.runner.js: require('dotenv').config();

From there, make sure you have a .env in your project with the following in it: BROWSERSTACK_ACCESS_KEY=<Your Key>

vedharish commented 5 years ago

@ckzgraphics Can you share local.log file generated in the working directory from the code? Check