Chromium won't load any websites and keeps crashing

Viewed 1284

All of the sudden my scripts aren't working anymore.

const puppeteer = require("puppeteer");

async function run() {
  const browser = await puppeteer.launch({
    headless: false
  });

  const page = await browser.newPage();

  await page.goto("https://www.google.com");

  // browser.close();
}

run();

When I run node index.js, Chromium launches, however, it is all white, then my mouse turns into the little rainbow spinning circle (Mac) and it crashes and I get the following error:

(node:37226) UnhandledPromiseRejectionWarning: Error: Navigation failed because browser has disconnected!

Thanks for any help!

1 Answers

I had the same problem on mac and solved it by adding '--no-sandbox' to the chrome args.

You can expose it as an env variable like so:

CHROME_ARGS=--no-sandbox

or add it to your browser.launch configuration:

const browser = await puppeteer.launch({
  headless: false, 
  args: ['--no-sandbox']
});
Related