Fixing Puppeteer Libgbm.so.1 Error on Ubuntu

When trying to run Puppeteer on Ubuntu, you may encounter the following error:

error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory

This error occurs because the required library libgbm.so.1 is missing on your system. To resolve this issue, you need to install the libgbm development package. Here’s a step-by-step guide on how to fix it:

Step 1: Update Package Lists

Before installing any packages, it’s always a good practice to update the package lists to ensure you are installing the latest versions available.

1
sudo apt update

Step 2: Install the libgbm Development Package

To install the libgbm development package, use the apt-get command as follows:

1
sudo apt-get install -y libgbm-dev

The -y flag is used to automatically confirm the installation without user intervention.

Step 3: Verify the Installation

After the installation is complete, you can verify if the library has been installed successfully.

1
ldconfig -p | grep libgbm

This command will show you if the libgbm library is present in the system library cache.

Step 4: Test Puppeteer

Now that you have installed the necessary library, try running your Puppeteer script again. The error should no longer occur, and Puppeteer should work as expected.

If you are using Puppeteer with Node.js, make sure you have it installed via npm:

1
npm install puppeteer

Conclusion

By following these steps, you should have fixed the “libgbm.so.1” error and Puppeteer should now run without any issues on your Ubuntu system.

0%