Closed Krinkle closed 8 years ago
I ran into this when upgrading from grunt-contrib-qunit v0.4.0 to v0.5.2 (which upgrades grunt-lib-phantomjs from v0.5.0 to v0.6.0).
After manually patching this file in node_modules
to check phantomJSHandle
first, there is still a fatal error I can't do much with:
- if (phantomJSHandle.pid){
+ if (phantomJSHandle && phantomJSHandle.pid){
Testing http://localhost:9412/krinkle-mediawiki-core/index.php?title=Special:JavaScriptTest/qunit
PhantomJS threw an error:ERROR
>> TypeError: Cannot call method 'charAt' of null 0 [ 'TypeError: Cannot call method \'charAt\' of null' ]
>> In order for this task to work properly, PhantomJS must be installed locally
>> via NPM. If you're seeing this message, generally that means the NPM install
>> has failed. Please submit an issue providing as much detail as possible at:
>> https://github.com/gruntjs/grunt-lib-phantomjs/issues
Seems similar to #54 and #59.
I am also having this same symptom with v0.6.0 on Windows 7 when using grunt-contrib-qunit
.
I am seeing the same error on my Mac when using grunt-contrid-jasmine on a fresh npm install – this issue is referred in https://github.com/gruntjs/grunt-contrib-jasmine/issues/156
When in run jasmine using grunt i see the following message. But this generates specRunner html file.Im trying to get the test execution summary on command line. And it fails because of following message.
Running "jasmine:unit" (jasmine) task Testing jasmine specs via PhantomJS
Warning: Cannot read property 'pid' of undefined Use --force to continue.
Aborted due to warnings.
Phantomjsjs: 1.9.8 grunt-contrib-jasmine: ~0.9(what ever is the latest)
TypeError: Cannot read property 'pid' of undefined
at kill (C:\nodejs\sample\node_modules\grunt-contrib-jasmine\node_modules\grun
t-lib-phantomjs\lib\phantomjs.js:59:28)
at cleanup (C:\nodejs\sample\node_modules\grunt-contrib-jasmine\node_modules\g
runt-lib-phantomjs\lib\phantomjs.js:65:31)
at C:\nodejs\sample\node_modules\grunt-contrib-jasmine\node_modules\grunt-lib-
phantomjs\lib\phantomjs.js:174:7
at callDone (C:\nodejs\sample\node_modules\grunt\node_modules\grunt-legacy-uti
l\index.js:159:5)
at Object.util.spawn (C:\nodejs\sample\node_modules\grunt\node_modules\grunt-l
egacy-util\index.js:178:7)
at EventEmitter.exports.spawn (C:\nodejs\sample\node_modules\grunt-contrib-jas
mine\node_modules\grunt-lib-phantomjs\lib\phantomjs.js:164:41)
at phantomRunner (C:\nodejs\sample\node_modules\grunt-contrib-jasmine\tasks\ja
smine.js:140:15)
at Object.
Aborted due to warnings.
Please help me. What am I doing wrong here?
Thanks!
From all the stack traces above, I conclude that there is a problem with the path of PhantomJS
binary. The package phantomjs
(aka phantomjs-prebuilt
) is the one responsible for installing and providing us the path of PhantomJS
binary.
So this issue has nothing to do with this package even if the error message says otherwise.
A fresh install of this package should fix the issue. If persist, please report it to https://github.com/Medium/phantomjs.
Closing this for now, feel free to ask if you have followup questions.
The
kill()
function assumesphantomJSHandle
has been assigned. However whencleanup()
is called in the immediate mode (likecleanup(null, true /* immediate */);
from thegrunt.util.spawn
callback), it has not returned a value yet and as such is still undefined because it runs synchronously.