meteor-pdf-tutorial icon indicating copy to clipboard operation
meteor-pdf-tutorial copied to clipboard

Error to call phantomjs in production.

Open felipesmendes opened this issue 8 years ago • 7 comments

Hi Ryan,

I'm developing my application in Windows but my server production is in Linux and when I call the webshot method is given this error:

Error: spawn /Tracker/bundle/programs/server/npm/node_modules/phantomjs-prebuilt/lib/phantom\bin\phantomjs.exe ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1057:32)
    at child_process.js:1151:20
    at process._tickCallback (node.js:355:11)

I think its because I installed NPM packages in Windows. Do you know how to solve it?

felipesmendes avatar Jul 22 '16 11:07 felipesmendes

How are you deploying your application? That error (ENOENT) means that a file is missing. The specific file is the phantom js binary. I suspect the reason its missing is because you built your application bundle on a windows machine and then deployed it to Linux. I've never developed a Meteor app on windows so I'm not sure what the best solution is. If you haven't given mupx a try that might be the way to go. It contains everything inside a docker container and is likely to resolve the issue.

ryanswapp avatar Jul 22 '16 14:07 ryanswapp

I'm deploying use meteor build and extracting it into Linux server.

I'll try to build in a linux and deploy it.

felipesmendes avatar Jul 22 '16 14:07 felipesmendes

Ya that's your problem then. Generally, you need to build your app in the environment in which you plan to deploy to.

ryanswapp avatar Jul 22 '16 14:07 ryanswapp

Cool, I'll try on linux and tell you,

Other dobt is on development I could make your example.

But wanted to know if I can instead of using pokemon-reports.html some other template out of the private folder in the case client/views, or other alternative of Asses.getText

This is because I have one big report and I don't wana create other template just to generate a PDF, I want to reuse it

felipesmendes avatar Jul 22 '16 14:07 felipesmendes

You don't need to use a template. The key is that you need to pass a string of html to webshot. You can build that however you'd like.

Get Outlook for iOS

    _____________________________

From: felipesmendes [email protected] Sent: Friday, July 22, 2016 8:40 AM Subject: Re: [ryanswapp/meteor-pdf-tutorial] Error to call phantomjs in production. (#5) To: ryanswapp/meteor-pdf-tutorial [email protected] Cc: Comment [email protected], Ryan Swapp [email protected]

Cool, I'll try on linux and tell you,

Other dobt is on development I could make your example.

But wanted to know if I can instead of using pokemon-reports.html some other template out of the private folder in the case client/views, or other alternative of Asses.getText

This is because I have one big report and I don't wana create other template just to generate a PDF, I want to reuse it

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ryanswapp avatar Jul 22 '16 14:07 ryanswapp

I understood, thank you!

Do you now some method to transform my template in a string?

Can I use Blaze.toHTML in server?

felipesmendes avatar Jul 22 '16 14:07 felipesmendes

You could grab all the html by calling the jquery html method on the outermost container. Something like $('.wrapper').html(). You would still need to add CSS to it which you could do server side with the juice npm module.

Get Outlook for iOS

On Fri, Jul 22, 2016 at 8:52 AM -0600, "felipesmendes" [email protected] wrote:

I understood, thank you!

Do you now some method to transform my template in a string?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ryanswapp avatar Jul 22 '16 15:07 ryanswapp