nextron icon indicating copy to clipboard operation
nextron copied to clipboard

Can't resolve 'ws' in "puppeteer-core/lib"

Open vsvanshi opened this issue 5 years ago • 8 comments

Hi Everyone, I am opening this issue here, after spending long time on the internet to resolve the related issue but no luck.

THE ISSUE: I am running an electron app with an example template of material ui and javascript. Everything is working fine, but when I install the "puppeteer-core" library (version 2.0.0) and import it like

import puppeteer from "puppeteer-core";

I start getting the following error

Screenshot 2020-01-06 at 3 27 58 PM

Ofcourse then I started looking at SO and Google for this error and the "resolution" that everyone is suggesting is to use the following setting for webpack.config.js file

const config = { // ... externals: { puppeteer: 'require("puppeteer")', // ... }, };

Since nextron is based on next js, the place that I could find to put this setting was in 'next.config.js' So I put the following code in it

... config.externals = { puppeteer :'require("puppeteer")' } ... return config;

But when I do this, A very strange error starts coming up.

Screenshot 2020-01-06 at 3 32 53 PM

I am really not sure, what is going on here.

It would be really helpful if someone can just tell me what is going on, and how to resolve this. Thanks in advance

vsvanshi avatar Jan 06 '20 10:01 vsvanshi

Are you still looking for help with this @vsvanshi?

lacymorrow avatar May 26 '20 09:05 lacymorrow

Yes, please @lacymorrow. I would definitely like to know what could have been done to prevent this error.

However for any user looking for a temporary solution, I had to leave nextron and proceed with "electron-webpack".

vsvanshi avatar May 26 '20 10:05 vsvanshi

Can you explain what you are trying to achieve with puppeteer inside electron?

On Tue, May 26, 2020 at 3:36 AM vsvanshi [email protected] wrote:

Yes, please @lacymorrow https://github.com/lacymorrow. I would definitely like to know what could have been done to prevent this error.

However for any user looking for a temporary solution, I had to leave nextron and proceed with "electron-webpack".

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/saltyshiomix/nextron/issues/65#issuecomment-633946019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAERNZBYQOQ5COLEZFOH3RTOLSDANCNFSM4KDCFXVQ .

lacymorrow avatar May 26 '20 17:05 lacymorrow

yes Sure @lacymorrow i am making a desktop application which enables a user to open a specific website using puppeteer and and run a testing script on that website and see it all in action

vsvanshi avatar May 28 '20 12:05 vsvanshi

Thanks @vsvanshi, I may have some time in the next couple of weeks to look into this

lacymorrow avatar May 29 '20 04:05 lacymorrow

@lacymorrow did you get a chance to look at this?

vsvanshi avatar Jul 12 '22 11:07 vsvanshi

@vsvanshi I ran into a similar issue, however I was able to resolve it by adding to the externals rather than overriding them.

... config.externals = [...config.externals, {whatever you wish to add}] ...

philipmckenna avatar Jan 11 '23 11:01 philipmckenna

Hello there ! I tried to look into the use of puppeteer within an electron app, did you try https://www.npmjs.com/package/puppeteer-in-electron this package ?

I did not yet made it work, but I think that's a better road so far. I might try to look into it further and work on an example with it when I can.

Let me know if there is any update about it !

Psycokwet avatar May 07 '23 15:05 Psycokwet