Reputation: 249
Every time I try to run a test using PhantomJS, Dalek gives me this error. However using GoogleChrome the test runs properly.
Running tests
/Users/user/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/index.js:273
this.spawned.kill('SIGTERM');
^
TypeError: Cannot read property 'kill' of null
at Object.PhantomJSDriver.kill (/Users/user/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/index.js:273:17)
at EventEmitter.emit (/Users/user/node_modules/dalekjs/node_modules/eventemitter2/lib/eventemitter2.js:312:17)
at Object.Dalek._shutdown (/Users/user/node_modules/dalekjs/lib/dalek.js:346:24)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
at process._fatalException (node.js:211:26)
What could the problem be?
Please note that I am using OS X 10.10.5 and I am beginner at Dalek and JS test automation. Thanks!
Upvotes: 0
Views: 762
Reputation: 560
Just ran into this issue and after reading a while got to this steps:
npm install phantom phantomjs -g
phantomjs -v
find . -name 'phantom*'
and identify dalek's phantomjs dependencyrm -fr ./node_modules/dalek-browser-phantomjs/node_modules/phantomjs
cp -r /usr/local/lib/node_modules/phantomjs ./node_modules/dalek-browser-phantomjs/node_modules/phantomjs
Hope it helps. Best regards.
Upvotes: 3
Reputation: 467
It looks like there are some files missing in dalek-browser-phantomjs
The missing folders/files are from dalek-browser-phantomjs/node-modules/phantomjs/lib
If you install phantomjs (npm install phantomjs) alone you get a file called "location.js"
+ a directory called "phantom"
. The location.js file contains the path to phantomjs and the phantom folder holds the binary.
Those two are missing, which leads to the error that this.spawned is set to null which throws the error at dalekjs/node_modules/dalek-browser-phantomjs/index.js:273:17
.
So in short:
yourproject/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/node-modules/
Now all your tests should work!
Upvotes: 2
Reputation: 331
I was running into the same problem.
I believe that the issue may be that your "node_modules" directory is being created with root permissions.
So, on the DalekJS home page it simply says to run the npm install commands without sudo or root. The first command installs the modules, the second command, however configures your directory for phantomJS usage--and if you call the second command (npm install dalekjs --save-dev
) with root privileges then that will cause problems.
So:
sudo npm install dalek-cli -g
This worked for me on OS X, and I wasn't able to find a fix anywhere else so thought I'd post... Hope it helps!
Upvotes: 1