How to install Google Chrome on WSL
There are times where you need a headless browser to run some test suite or run some jobs to generate files like critical css. This guide will show you how to install headless Google Chrome on Linux or WSL
Installing Google Chrome
- Ensure your dependencies are up to date.
sudo apt update && sudo apt -y upgrade
- Download and install Google Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo apt -y install ./google-chrome-stable_current_amd64.deb
- Verify if Google Chrome installation is successful
which google-chrome google-chrome --version
If you encounter this error:
Error: Failed to launch the browser process! /e/workspace/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md at onClose (/e/workspace/node_modules/puppeteer/lib/Launcher.js:750:14) at Interface.<anonymous> (/e/workspace/node_modules/puppeteer/lib/Launcher.js:739:50) at Interface.emit (node:events:402:35) at Interface.close (node:readline:586:8) at Socket.onend (node:readline:277:10) at Socket.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)
Install the following lib should fix the error.
sudo apt-get install -y libxss1