0

I am trying to create a Mink Connection With the Zombie Driver But I am Getting an Error. All ports are open and I have tried using my servers IP.

My Code:

$driver = new \Behat\Mink\Driver\ZombieDriver('127.0.0.1');
$zombieSession = new \Behat\Mink\Session($driver);
$zombieSession->start();

Error:

Fatal error: Uncaught exception 'RuntimeException' with message 'Server process has 
been terminated: (127) [sh: node: command not found ]' in /home/runniog5/public_html/subdomains/testing4/vendor/behat/mink-zombie-driver/src/Behat/Mink/Driver/NodeJS/Server.php:406
Stack trace: #0 /home/runniog5/public_html/subdomains/testing4/vendor/behat/mink-zombie-driver/src/Behat/Mink/Driver/NodeJS/Server.php(302): 
Behat\Mink\Driver\NodeJS\Server->checkAvailability() #1 /home/runniog5/public_html/subdomains/testing4/vendor/behat/mink-zombie-driver/src/Behat/Mink/Driver/ZombieDriver.php(107): 
Behat\Mink\Driver\NodeJS\Server->start() #2 /home/runniog5/public_html/subdomains/testing4/vendor/behat/mink/src/Behat/Mink/Session.php(62): 
Behat\Mink\Driver\ZombieDriver->start() #3 /home/runniog5/public_html/subdomains/testing4/test.php(114): 
Behat\Mink\Session->start() #4 {main} thrown in /home/runniog5/public_html/subdomains/testing4/vendor/behat/mink-zombie-driver/src/Behat/Mink/Driver/NodeJS/Server.php 
on line 406
Alex Pelletier
  • 4,933
  • 6
  • 34
  • 58

2 Answers2

0

Make sure you have Node installed and it's functional. Server process has been terminated: (127) [sh: node: command not found ] tells you that shell cannot find node command. To verify you've got it run node -v it should print the current installed version.

Ian Bytchek
  • 8,804
  • 6
  • 46
  • 72
0

The problem is that the ZombieServer doesn't know the path to the binary of your node. To solve this, use this code:

$zombieServer = new ZombieServer($host, $port, $pathToYourNodeBinary, $serverPath, $threshold, $pathToYourNodeModules);
$zombieDriver = new ZombieDriver($zombieServer);
$session = new Session($zombieDriver);
$mink = new Mink(array('zombie' => $session));

In my case, $pathToYourNodeBinary and $pathToYourNodeModules are:

$pathToYourNodeBinary = '/usr/local/bin/node';
$pathToYourNodeModules = '/usr/local/lib/node_modules/';

You can get to know what are your paths using these commands (in case you are running Mac with OSX):

which node
which npm

Of course you need to set up the rest of the ZombieServer constructor variables. To get to know the default values just have a look on its implementation in your vendor library or at github.com

honzalilak
  • 366
  • 2
  • 11