How do I solve "Server terminated early with status 127" when running node.js on Linux?

Dave picture Dave · Apr 5, 2016 · Viewed 12.5k times · Source

I’m using node 5.10.0 on this version of Linux

[davea@mydevbox mydir]$ uname -a
Linux mydevbox.mydomain.com 7.3.8-25.26.amzn1.x86_64 #1 SMP Wed Mar 16 17:15:34 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

I’m getting the below error when running my script (“Server terminated early with status 127”). I have verified that I can reach the URL in question using “wget”, so I can’t tell what else I need to make this thing work …

[davea@mydevbox mydir]$ node myscript.js 
Validation Complete
/home/davea/node_modules/selenium-webdriver/lib/promise.js:654
    throw error;
    ^

Error: Server terminated early with status 127
    at Error (native)
    at /home/davea/node_modules/selenium-webdriver/remote/index.js:242:20
    at ManagedPromise.invokeCallback_ (/home/davea/node_modules/selenium-webdriver/lib/promise.js:1343:14)
    at TaskQueue.execute_ (/home/davea/node_modules/selenium-webdriver/lib/promise.js:2868:14)
    at TaskQueue.executeNext_ (/home/davea/node_modules/selenium-webdriver/lib/promise.js:2851:21)
    at /home/davea/node_modules/selenium-webdriver/lib/promise.js:2730:27
    at /home/davea/node_modules/selenium-webdriver/lib/promise.js:639:7
    at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
    at acquireSession (/home/davea/node_modules/selenium-webdriver/lib/webdriver.js:107:22)
    at Function.createSession (/home/davea/node_modules/selenium-webdriver/lib/webdriver.js:337:12)
    at Driver (/home/davea/node_modules/selenium-webdriver/chrome.js:778:38)
    at Builder.build (/home/davea/node_modules/selenium-webdriver/builder.js:464:16)
    at Object.<anonymous> (/home/davea/mydir/js/Optimus.js:14:4)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
From: Task: WebDriver.navigate().to(http://localhost:8081/myproject)
    at Driver.schedule (/home/davea/node_modules/selenium-webdriver/lib/webdriver.js:386:17)
    at Navigation.to (/home/davea/node_modules/selenium-webdriver/lib/webdriver.js:1029:25)
    at Driver.get (/home/davea/node_modules/selenium-webdriver/lib/webdriver.js:797:28)
    at Object.exports.Login.Page (/home/davea/mydir/js/Optimus.js:505:16)
    at Object.exports.smokeTest (/home/davea/mydir/js/Optimus.js:2442:19)
    at Object.<anonymous> (/home/davea/mydir/SkyNet.js:13:6)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)

Answer

Johannes Rudolph picture Johannes Rudolph · Nov 28, 2016

In my case I was missing a Java Runtime environment (JRE). I'm running e2e tests with Selenium in a Debian-based docker image, hence apt-get install default-jre did the trick for me. It's a pity selenium doesn't give a more useful error message in this case.