Fix “running as root without –no-sandbox” Error in Puppeteer

spot_img

Share This Post

The Google Dev Team’s Puppeteer is a strong tool for browser automation and scraping.

Puppeteer is a node library that runs a headless version of Chrome or Chromium and can do a lot of things. From screenshots to form submissions, we’ve got you covered.

You can run into a normal error when you first start using Puppeteer.

Failed to launch the browser process! 
Running as root without --no-sandbox is not supported.

Let’s look at how to repair the Puppeteer error “running as root without –no-sandbox.

The Solution


The answer is simple, but there are some limitations. We can add certain options to the Puppeteer browser launcher to fix the bug completely.

 puppetter.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']})

This command adds the —no-sandbox and —disable-setuidsandbox options to our launcher.

Although adding these options will make your puppeteer code execute, the authors advise against doing so since they may constitute a security risk.

Only use the above two flags if you’re confident about the material you’ll be opening in Puppeteer’s headless Chrome browser.

Consider creating a user and allowing user namespace cloning in your environment. More information about the subject may be found here.

You now know how to fix the Puppeteer error “running as root without –no-sandbox.” We hope you enjoy your time with Puppeteer. Have fun coding.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related Posts

6 Best Home Generators

If you live in an area where you experience...

How to Choose Best Lift Chair?

For people with physical disabilities and the elderly, getting...

NuWave Brio Air Fryer Review

Craving for some fried goods but scared of the...

Commercial Toaster: Top Picks with Buying Guide and FAQs

Commercial Toaster: Top Picks with Buying Guide and FAQs...

Best High-Velocity Blower Fans

Does your room feel so warm during the summer?...

10 Best Xbox One Gaming Chair: Buying Guide And Reviews

For some people, console gaming should have the right...
spot_img
- Advertisement -spot_img