karma-phantomjs-launcher
karma-phantomjs-launcher copied to clipboard
Mac Os Sierra "Cannot start PhantomJS"
However I am not 100% sure that this issue is related to Sierra, It seems the only thing changed in a project already configured and working.
12 09 2016 16:48:20.494:DEBUG [preprocessor.coverage]: Processing "/Users/anyuser/Documents/xcode/anyproject-backend/src/test/javascript/spec/components/auth/auth.services.spec.js".
12 09 2016 16:48:20.504:INFO [karma]: Karma v0.13.19 server started at http://localhost:9876/
12 09 2016 16:48:20.509:INFO [launcher]: Starting browser PhantomJS
12 09 2016 16:48:20.509:DEBUG [temp-dir]: Creating temp dir at /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688
12 09 2016 16:48:20.511:DEBUG [launcher]: /Users/anyuser/Documents/xcode/anyproject-backend/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688/capture.js
12 09 2016 16:48:20.618:DEBUG [launcher]: Process PhantomJS exited with code 0
12 09 2016 16:48:20.618:ERROR [launcher]: Cannot start PhantomJS
12 09 2016 16:48:20.618:DEBUG [temp-dir]: Cleaning temp dir /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688
12 09 2016 16:48:20.622:INFO [launcher]: Trying to start PhantomJS again (1/2).
12 09 2016 16:48:20.623:DEBUG [launcher]: Restarting PhantomJS
12 09 2016 16:48:20.623:DEBUG [temp-dir]: Creating temp dir at /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688
12 09 2016 16:48:20.624:DEBUG [launcher]: /Users/anyuser/Documents/xcode/anyproject-backend/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688/capture.js /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688/capture.js
12 09 2016 16:48:20.723:DEBUG [launcher]: Process PhantomJS exited with code 0
12 09 2016 16:48:20.723:ERROR [launcher]: Cannot start PhantomJS
12 09 2016 16:48:20.723:DEBUG [temp-dir]: Cleaning temp dir /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688
12 09 2016 16:48:20.724:INFO [launcher]: Trying to start PhantomJS again (2/2).
12 09 2016 16:48:20.724:DEBUG [launcher]: Restarting PhantomJS
12 09 2016 16:48:20.724:DEBUG [temp-dir]: Creating temp dir at /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688
12 09 2016 16:48:20.725:DEBUG [launcher]: /Users/anyuser/Documents/xcode/anyproject-backend/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688/capture.js /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688/capture.js /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688/capture.js
12 09 2016 16:48:20.827:DEBUG [launcher]: Process PhantomJS exited with code 0
12 09 2016 16:48:20.827:ERROR [launcher]: Cannot start PhantomJS
12 09 2016 16:48:20.827:DEBUG [temp-dir]: Cleaning temp dir /var/folders/dj/j_jl7qxx06x59n9tfmkxh6s40000gn/T/karma-44720688
12 09 2016 16:48:20.829:ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.
12 09 2016 16:48:20.830:DEBUG [karma]: Run complete, exiting.
12 09 2016 16:48:20.830:DEBUG [launcher]: Disconnecting all browsers
12 09 2016 16:48:20.833:DEBUG [reporter.jenkins]: Xml results written to "/Users/anyuser/Documents/xcode/anyproject-backend/target/test-results/karma/TESTS-results.xml".
Warning: Task "karma:unit" failed. Use --force to continue.
Any Idea?
From what I can tell, the problem is caused by the version of PhantomJS installed by karma-phantomjs-launcher
. When I run the phantomjs binary directly, it returns a segfault (11).
When I updated karma-phantomjs-launcher
to the newest version (1.0.2), the binary no longer segfaults, and the tests complete successfully. I also updated Karma to 1.3.0, but not sure whether that's actually necessary
Same issue. I've noticed that using phantomjs v2 (included in v1.0.2 of karma-phantomjs-launcher) seems to work fine. However, some of the tests in my rather large project fail with the phantomjs 2. The only solution for me may be to go back to El Capitan until there is time to update phantomjs and the tests.
in case anyone is depending on this task in a project, I can confirm that running the test using 'Chrome' works
DISCLAIMER: this is only intended as a workaround for someone who is using frameworks (like jHipsters) with this dependency which broke the building process such as me :)
in karma.conf.js
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],//Was PhantomJS
Sadly I too can't run Phantomjs2 due to some kind of race condition between my initial setup scripts (that setup external browserify deps) and the tests themselves which require those browserify externals (meaning I get Error: Cannot find module 'xxx'
). This doesn't happen in Phantom 1.9. But that is unrelated to this, just a note for anyone else who might be caught up by it.
Same issue. @superandrew work around works as a hack for now
+1 , doesn't work in macOS sierra. Chrome takes too much time to load the test suite.
@hamxabaig @kayschmitt Phantom2 doesn't work for you? I doubt anyone will patch Phantom 1.9 to support Sierra, so there's not much karma-phantomjs-launcher
can do to help.
@llhupp have you been able to detect any patterns with the tests that fail in Phantom 2?
@justinjmoses i'm upgrading to Phantom2. Will let you know in a bit.
okay, Phantom v 2.1.1
solves this.
I filed this for Phantom 1.9.8. https://github.com/ariya/phantomjs/issues/14558
Same issue and I can't upgrade to Phantom v2...
Just got this error, unable to fix with any of updates.
FWIW I worked around my particular problem (Phantom 2 upgrade) by ensuring all test bundles (we're using browserify) include all their dependencies rather than externalizing them.
I had this issue earlier this week but was able to run phantomjs
from the command line.
Adding export PHANTOMJS_BIN=/usr/local/bin/phantomjs
to my .bashrc/.zshrc seemed to fix it.
Just updated to OS Sierra and my setup don't work anymore.
Here is my part of package.json:
"jasmine-core": "~2.5.2",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-htmlfile-reporter": "^0.3.4",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-systemjs": "^0.15.0",
"karma-typescript-preprocessor": "^0.3.0",
"phantomjs-prebuilt": "^2.1.13"`
when I run karma start then I get following error:
20 10 2016 10:47:18.951:DEBUG [middleware:karma]: custom files null null
20 10 2016 10:47:18.951:DEBUG [middleware:karma]: Serving static request /context.html
20 10 2016 10:47:18.952:DEBUG [web-server]: serving: /Users/clke/.nvm/versions/node/v6.6.0/lib/node_modules/karma/static/context.html
20 10 2016 10:47:18.954:DEBUG [web-server]: serving: /Users/clke/.nvm/versions/node/v6.6.0/lib/node_modules/karma/static/context.js
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
You need to include some adapter that implements __karma__.start method!
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
You need to include some adapter that implements __karma__.start method!
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
You need to include some adapter that implements __karma__.start method!
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0.025 secs / 0 secs)
It drives me crazy I wasted already so much of time due to this error.
Anyone any idea?
Thx a lot
same issue, any idea?
Another workaround for this is using Electron instead of Phantom via https://github.com/lele85/karma-electron-launcher. I managed to upgrade to Phantom 2.1..1 but tried using Electron as a POC and it ran our 10k specs in the same time as Phantom 2
My issue wasn't with Phantom js, I had to upgrade "grunt-contrib-jasmine": "^1.0.3".
You need to figure out what directory you have your node, npm-cache and npm (if you installed it out of node) installed. Then, you give permission of execute and read. Usually, the npm-cache is located at:
~/.npm/
to find out where is your node and npm:
which node
which npm
Note: Those commands above will probably give you the folder "bin" so, get the folder node and npm to apply the permission. E.g FOR: "/usr/local/Cellar/node/bin/" YOU'RE GONNA USE: "/usr/local/Cellar/node/" Then, apply the permissions. It should work:
sudo chmod -R +xr PATH_NPM_CACHE_HERE
sudo chmod -R +xr PATH_NPM_HERE
sudo chmod -R +xr PATH_NODE_HERE
Everytime when Mac OS updates (MAJOR Updates like maverick, mount lion, sierra) we lose some permissions. That is why those errors pop up.
Also, I upgrade from "karma-phantomjs-launcher@~0.1.4" to "[email protected]".
Also, it might be helpful Issue: https://github.com/karma-runner/karma-phantomjs-launcher/issues/84 Comment: https://github.com/karma-runner/karma-phantomjs-launcher/issues/84#issuecomment-252054603
"phantomjs": "^2.1.3" solve problems for me in Mac Os sierra
On mac sierra the bug is located at this place into karma-phantomjs-launcher/index.js I'm not familiar with javascript but it seems that phantom-source is null
TypeError: Path must be a string. Received null
at assertPath (path.js:7:11)
at Object.extname (path.js:1431:5)
at phantomJSExePath (../node_modules/karma-phantomjs-launcher/index.js:19:12)
in the index.js file we can find:
var phantomJSExePath = function () {
13 // If the path we're given by phantomjs is to a .cmd, it is pointing to a global copy.
14 // Using the cmd as the process to execute causes problems cleaning up the processes
15 // so we walk from the cmd to the phantomjs.exe and use that instead.
16
17 var phantomSource = require('phantomjs-prebuilt').path
18
19 if (path.extname(phantomSource).toLowerCase() === '.cmd') {
20 var phantomPackage = require('phantomjs-prebuilt/package.json')
21 return path.join(path.dirname(phantomSource), '//node_modules//phantomjs//lib//phantom//', phantomPackage.bin.phantomjs)
22 }
23
24 return phantomSource
25 }
npm install [email protected] worked for me on mac Sierra
npm install [email protected] worked for me on mac Sierra works also but it's when you use you would have this kind of error
Just updating the the launcher to "karma-phantomjs-launcher": "^1.0.0" in package.json, but I would probably upgrade the phantomjs package as well if you have control.
For what it's worth, I ran into this today. Adding export PHANTOMJS_BIN=/usr/local/bin/phantomjs
to my .bash_profile resolved this for me.
I ran into same error like @obeyler mentioned, looks like still not fixed?
TypeError: Path must be a string. Received null
at assertPath (path.js:7:11)
at Object.extname (path.js:1431:5)
at phantomJSExePath (../node_modules/karma-phantomjs-launcher/index.js:19:12)
I'm running into the same issue still after upgrading to Sierra.
Tried: upgrading phantomjs to 2.1.1 upgrading karma-phantomjs-launcher to 1.0.4 adding export PHANTOMJS_BIN=/usr/local/bin/phantomjs to my .bash_profile updating permissions to: sudo chmod -R +xr PATH_NPM_CACHE_HERE sudo chmod -R +xr PATH_NPM_HERE sudo chmod -R +xr PATH_NODE_HERE
any other ideas?
#191 trying to fix Path must be a string. Received null
, or at least provide a better error message
Found this error to also happen if you end up using Karma directly from github source. Turns out there is a difference between the Karma code on npm and the one on github. See: https://github.com/nano3labs/karma/pull/1.
It was falsely indicating this error for me. So make sure you don't use something like:
// package.json
"dependencies": {
"karma": "karma-runner/karma"
}