Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

occasionally I get "phantom manager could not start all workers" error #107

Open
darkopetreski opened this issue Jun 3, 2019 · 4 comments

Comments

@darkopetreski
Copy link

darkopetreski commented Jun 3, 2019

I am using phantom-html-to-pdf version 0.5.6 on debian 9 to generate pdf files from html.
Occasionally I get the following error, and cannot see any pattern when it happens. Just it happens sometimes. Any idea what could be the problem and how to fix it ?

{ Error: phantom manager could not start all workers.. at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomManager.js:66:47 at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomWorker.js:117:24 at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomWorker.js:140:20 at Socket.<anonymous> (/var/www/dev/backend/node_modules/phantom-workers/lib/checkPortStatus.js:45:9) at Socket.emit (events.js:198:13) at TCP._handle.close (net.js:606:12) workerErrors: [ Error: Unable to reach phantomjs web server. at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomWorker.js:140:23 at Socket.<anonymous> (/var/www/dev/backend/node_modules/phantom-workers/lib/checkPortStatus.js:45:9) at Socket.emit (events.js:198:13) at TCP._handle.close (net.js:606:12), Error: Unable to reach phantomjs web server. at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomWorker.js:140:23 at Socket.<anonymous> (/var/www/dev/backend/node_modules/phantom-workers/lib/checkPortStatus.js:45:9) at Socket.emit (events.js:198:13) at TCP._handle.close (net.js:606:12) ] } /var/www/dev/backend/htmlToPdf.js:46 pdf.stream.pipe(output).on('finish', () => process.exit()); ^ TypeError: Cannot read property 'stream' of undefined at /var/www/dev/backend/htmlToPdf.js:46:17 at /var/www/dev/backend/node_modules/phantom-html-to-pdf/lib/serverStrategy.js:42:20 at /var/www/dev/backend/node_modules/phantom-html-to-pdf/lib/serverStrategy.js:22:48 at Array.forEach (<anonymous>) at /var/www/dev/backend/node_modules/phantom-html-to-pdf/lib/serverStrategy.js:22:25 at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomManager.js:68:28 at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomWorker.js:117:24 at /var/www/dev/backend/node_modules/phantom-workers/lib/phantomWorker.js:140:20 at Socket.<anonymous> (/var/www/dev/backend/node_modules/phantom-workers/lib/checkPortStatus.js:45:9) at Socket.emit (events.js:198:13)

@pofider
Copy link
Owner

pofider commented Jun 4, 2019

Is it an option for you to use dedicated-process strategy? It should help
https://github.com/pofider/phantom-html-to-pdf#global-options

@darkopetreski
Copy link
Author

Thank you for the advice, I will give it a try :)

@rspacecode
Copy link

rspacecode commented Oct 5, 2019

I also have same issue please help me if any one fixed it, I am creating .exe of node and facing this error, with source code its working but not working with executable.
I also tried this : https://github.com/pofider/phantom-html-to-pdf#global-options
but same result

{ Error: phantom manager could not start all workers..
at E:\snapshot\fileserver\node_modules\phantom-workers\lib\phantomManager.js:65:47
at E:\snapshot\fileserver\node_modules\phantom-workers\lib\phantomWorker.js:103:24
at E:\snapshot\fileserver\node_modules\phantom-workers\lib\phantomWorker.js:128:20
at Socket. (E:\snapshot\fileserver\node_modules\phantom-workers\lib\checkPortStatus.js:45:9)
at Socket.emit (events.js:189:13)
at TCP._handle.close (net.js:597:12)
workerErrors:
[ { Error: spawn E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
errno: 'ENOENT',
code: 'ENOENT',
syscall:
'spawn E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe',
path:
'E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe',
spawnargs: [Array],
cmd:
'E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any E:\snapshot\fileserver\node_modules\phantom-html-to-pdf\lib\scripts\serverScript.js' },
{ Error: spawn E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
errno: 'ENOENT',
code: 'ENOENT',
syscall:
'spawn E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe',
path:
'E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe',
spawnargs: [Array],
cmd:
'E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any E:\snapshot\fileserver\node_modules\phantom-html-to-pdf\lib\scripts\serverScript.js' } ] }

@bjrmatos
Copy link
Collaborator

bjrmatos commented Oct 7, 2019

{ Error: spawn E:\snapshot\fileserver\node_modules\phantom-workers\node_modules\phantomjs\lib\phantom\phantomjs.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)

the ENOENT error means that during execution phantomjs.exe could not be found.. this is common to see in exe builds, and you have to check the docs of the packager you are using (i guess it is pkg) to discover how to include/discover the phantom.exe in the exe you are creating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants