isy / portan

Always on top Webview
https://isy.github.io/portan
3 stars 0 forks source link

Getting Puppeteer working inside Electron. #5

Open mvaneijgen opened 4 years ago

mvaneijgen commented 4 years ago

Sorry to bother you, but I came across your app while researching my own project which I'm trying to build in Electron. My app is done, Screenshot Generator. Really happy how it functions, the only slight problem is that it doesn't work... I have a Generate button compontent form which I try to launch a puppeteer.js script, but I just don't know how to invoke it.

Screenshot Generator App Preview

Seen that you've got it working, I thought maybe you could take a look and maybe give me some pointers on how I could get it to work in my project. If not please just close this issue and I thank you for your time.

isy commented 4 years ago

@mvaneijgen Sorry for the delay in contacting you. Has this problem been resolved?

I solved this problem by including chromium in my application. https://github.com/isy/portan/blob/e5fb4327cdd4f957bcacfab69a203c6268714999/package.json#L32

Your application seems to be trying this solution as well, but your version of puppeteer may not include .local-chromium https://github.com/puppeteer/puppeteer/issues/2134#issuecomment-553892345

So please try to find another way or lower your puppeteer version

mvaneijgen commented 4 years ago

Yes I saw that in your project and I seem to have copied that and I don't know if that did the trick, but I have it now working in my development version of Electron, but as soon as I build my package and run in from a build script all I get is

events.js:183 Uncaught Error: write EPIPE
    at _errnoException (util.js:1024)
    at WriteWrap.afterWrite [as oncomplete] (net.js:867)
_errnoException @ util.js:1024
afterWrite @ net.js:867
renderer.js:1 err on spawn  Error: spawn node ENOENT
    at _errnoException (util.js:1024)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190)
    at onErrorNT (internal/child_process.js:372)
    at _combinedTickCallback (internal/process/next_tick.js:138)
    at process._tickCallback (internal/process/next_tick.js:180)

I'm kinda stuck again now. Everything works fine when I'm developing the application, but i juist can't npm run build it