2015-03-13 22 views
5

Quando si esegue Karma da un'installazione locale sul mio progetto sulla mia VM Ubuntu, Karma non verrà eseguito perché PhantomJS non può essere avviato. InformazioniQuando si esegue karma localmente, phantomjs non verrà avviato

Versione:

  • PhantomJS (anche installati localmente): 1.9.16
  • Karma: 0.12.31
  • karma-phantomjs-launcher: 0.1.4
  • Ubuntu 14.04 .2 LTS
  • Nodo 0.10.25

Lo stesso script funziona perfettamente sul mio Mac OS (ho rimosso le installazioni globali di karma prima di eseguirlo e funzionava ancora).

Su Ubuntu, se avvio phantomjs direttamente tramite ./node_modules/phantomjs/bin/phantomjs, inizia perfettamente.

ecco l'output della shell:

> ./node_modules/karma/bin/karma start test/karma.conf.js 

DEBUG [config]: autoWatch set to false, because of singleRun 
DEBUG [plugin]: Loading karma-* from /srv/detectiveui/node_modules 
DEBUG [plugin]: Loading plugin /srv/detectiveui/node_modules/karma-jasmine. 
DEBUG [plugin]: Loading plugin /srv/detectiveui/node_modules/karma-phantomjs-launcher. 
DEBUG [plugin]: Loading plugin /srv/detectiveui/node_modules/karma-spec-reporter. 
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/ 
INFO [launcher]: Starting browser PhantomJS 
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-42625347 
DEBUG [launcher]: /srv/detectiveui/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-42625347/capture.js 
DEBUG [launcher]: Process PhantomJS exited with code 2 
ERROR [launcher]: Cannot start PhantomJS 

DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-42625347 
INFO [launcher]: Trying to start PhantomJS again (1/2). 
DEBUG [launcher]: Restarting PhantomJS 
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-42625347 
DEBUG [launcher]: /srv/detectiveui/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-42625347/capture.js /tmp/karma-42625347/capture.js 
DEBUG [watcher]: Resolved files: 
    #...List of my files here that look correct... 
DEBUG [launcher]: Process PhantomJS exited with code 2 
ERROR [launcher]: Cannot start PhantomJS 

DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-42625347 
INFO [launcher]: Trying to start PhantomJS again (2/2). 
DEBUG [launcher]: Restarting PhantomJS 
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-42625347 
DEBUG [launcher]: /srv/detectiveui/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-42625347/capture.js /tmp/karma-42625347/capture.js /tmp/karma-42625347/capture.js 
DEBUG [launcher]: Process PhantomJS exited with code 2 
ERROR [launcher]: Cannot start PhantomJS 

DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-42625347 
ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up. 

DEBUG [karma]: Run complete, exiting. 
DEBUG [launcher]: Disconnecting all browsers 

mi sembra anche di essere in grado di avviare manualmente un server nodo sulla porta 9876, in modo che probabilmente non è il problema neanche.

Qualsiasi aiuto sarebbe molto apprezzato. Grazie!

---- UPDATE

ho creato un nuovo ambiente di Ubuntu e testati di nuovo la stessa cosa e ottenuto lo stesso errore.

+1

Sono di fronte a un problema simile ma con 'codice di uscita 1' – TechSpellBound

+0

In linea con il mio commento precedente, il problema (che ho citato nel commento) è stato risolto per me in Ubuntu 14.04 di cancellando la directory 'node_modules' dal progetto (che era stata controllata da qualcun altro usando un Macbook). Ho eseguito di nuovo 'npm install' e la directory' node_modules' è stata ricreata. Abbiamo anche aggiunto la directory 'node_modules' a' .gitignore' per evitare questo problema in futuro. – TechSpellBound

+0

Interessante, dovrò provare di nuovo quando avrò la possibilità. Stavo usando Vagrant con un host Mac, in modo che potesse spiegarlo. Pubblicherò i risultati quando lo testerò più tardi. – ccnokes

risposta

1

L'installazione di libfontconfig tramite sudo apt-get install libfontconfig può risolvere questo problema.

1

Ho affrontato lo stesso problema, la soluzione che ha funzionato per me è quello di eseguire sudo yum install fontconfig, Il comando deve essere eseguito nella posizione giusta, ma questo funziona ..

2

Ho affrontato lo stesso problema, ho cambia karma-phantomjs-launcher in "^ 1.0.0" nel file package.json. Dopo la modifica, Phantomjs ha iniziato a funzionare

+0

sì, questo ha funzionato anche per me. Grazie! – pratyush

Problemi correlati