title: How to Fix Puppeteer chromium-browserxdg-settings: not found Problem?
body: <p>Recently we have updated our Ubuntu server hard Disk, after updating I am getting errors when I try to scrape data using puppeteer as mentioned below:</p>
  <pre><code>Could not create a browser instance =&gt; :  Error: Failed to launch the browser process!
  1|app  | /usr/bin/chromium-browser: 12: xdg-settings: not found
  1|app  | cannot perform operation: umount --no-follow /var/lib/snapd/hostfs//tmp/snap.rootfs_grFzK6: Invalid argument
  1|app  | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
  1|app  |     at onClose (/home/secfusionread/scrape/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
  1|app  |     at ChildProcess.&lt;anonymous&gt; (/home/secfusionread/scrape/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:79)
  
  </code></pre>
  <p>My Puppeteer connection code below, I was able to scrape data before the updating.</p>
  <pre><code>const puppeteer = require(&quot;puppeteer&quot;);
  
  async function startBrowser() {
    let browser;
    //console.log(process.env.NODE_ENV);
    try {
      console.log(&quot;----------- Open the browser ------------&quot;);
      browser = await puppeteer.launch({
        // userDataDir: &quot;../cache&quot;,
        executablePath:
          process.env.NODE_ENV === &quot;production&quot;
            ? &quot;/usr/bin/chromium-browser&quot;
            : &quot;&quot;,
        args: [
          &quot;--no-sandbox&quot;,
          &quot;--disable-setuid-sandbox&quot;,
          &quot;--disable-dev-shm-usage&quot;,
          &quot;--disable-accelerated-2d-canvas&quot;,
          &quot;--no-first-run&quot;,
          &quot;--no-zygote&quot;,
          &quot;--single-process&quot;,
          &quot;--disable-gpu&quot;,
        ],
        headless: true,
        timeout: 6000,
      });
    } catch (err) {
      console.log(&quot;Could not create a browser instance =&gt; : &quot;, err);
    }
    return browser;
  }
  
  async function startPage(browser) {
    let page;
    try {
      console.log(&quot;----------- Open a new page ------------&quot;);
      page = await browser.newPage();
      await page.setViewport({ width: 1200, height: 800 });
      await page.setExtraHTTPHeaders({
        &quot;Accept-Language&quot;: &quot;en-US,en;q=0.9&quot;,
      });
      await page.setUserAgent(
        &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36&quot;
        // &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36&quot;
      );
      // await page.setRequestInterception(true);
      // page.on(&quot;request&quot;, (req) =&gt; {
      //   if (req.resourceType() === &quot;font&quot; || req.resourceType() === &quot;image&quot;) {
      //     req.abort();
      //   } else {
      //     req.continue();
      //   }
      // });
    } catch (err) {
      console.log(&quot;Could not create a new page =&gt; : &quot;, err);
    }
    return page;
  }
  
  module.exports = {
    startBrowser,
    startPage,
  };
  
  </code></pre>
  <p>chromium-browser exists in <code>/usr/bin/chromium-browser</code>, I tried a lot of code from google but nothing works.</p>