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

Puppeteer didn't work for me on Windows #3

Open
jensgro opened this issue Aug 19, 2020 · 3 comments
Open

Puppeteer didn't work for me on Windows #3

jensgro opened this issue Aug 19, 2020 · 3 comments

Comments

@jensgro
Copy link

jensgro commented Aug 19, 2020

I have node 14.8-0 installed via nvm on Windows10 with WSL1.
I installed yarn after calling npm start didn't work. The outcome wasn't better.
Be it npm or yarn, the call results mainly with the same errors:

yarn-error

reject(new Error([
                   ^

Error: Failed to launch the browser process!
@jensgro
Copy link
Author

jensgro commented Aug 19, 2020

I modified the browser-constant that way:

const browser = await puppeteer.launch({
    headless: true,
    ignoreDefaultArgs: ['--disable-extensions'],
    args: ['--no-sandbox', '--disable-setuid-sandbox']
});

The source of the changes were two pages:

  1. https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-windows
  2. Puppeteer doesn't run under WSL (Windows subsystem for Linux) puppeteer/puppeteer#1837

It seems to be a known problem, that puppeteer doesn't work on WSL, although it is a slightly crippled Ubuntu.

I did the tests on my private computer because of your decision to use the latest and greatest and I didn't want my business machine have a slightly strange configuration. On my business machine runs node 12.something.

On my business machine a already do tests with puppeteer, so it is no general Windows-problem.

On the other hand: I don't see how I could run it on my private machine "outside" WSL.

@umaar
Copy link
Owner

umaar commented Aug 20, 2020

Ok interesting so those changes you made, does it work now?

By any chance did you try the version of the code in 1-testing-old-node? I did this to hopefully support older versions of Node.js, where I manually changed each instance of top-level await, and ES Module imports, do use their 'older' counterparts.

I wonder if it would work on your private business computer now?

If the changes you suggested are still not working: I would possibly try these:

npm i -g npx
# Then try npx again

# Remove the package-lock.json file and run
npm cache verify
npm install

# I'm not familiar with WSL as I don't use Windows, but could you try the regular command prompt

So I think 5 things to try:

  1. The solution you posted in your previous comment
  2. Updating npx
  3. Remove package-lock file and node_modules, verify npm cache and npm install
  4. As I have only tested the command prompt in a Virtual Box Windows, please try that instead of WSL
  5. Also try the version 1-testing-old-node on your business machine which uses node 12

Hopefully one of those things works! Unless you already got it working with the solution you mentioned above

@jensgro
Copy link
Author

jensgro commented Aug 20, 2020

Both changes had no effect.
I will hopfeully have the time to test you ideas in the next days. But in the next days I will be very busy. Sorry.

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

2 participants