Fixing "error while loading shared libraries: libnspr4.so" for Playwright with no root access A developer published an MIT-licensed script that installs Playwright browser dependencies without root access by using apt-get download and dpkg-deb -x to unpack .deb packages into a local prefix and setting LD_LIBRARY_PATH. The tool, rootless-playwright, dynamically discovers the required package list from Playwright itself and verifies the browser launches, addressing the recurring libnspr4.so shared library error in restricted environments like containers and CI runners. I was setting up browser automation for an AI coding agent running in a locked-down sandbox this week — no sudo , no passwordless root, nothing. npx playwright install --with-deps chromium failed immediately, and running the browser directly threw this: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory followed by the same error for another 30-odd libraries once you fix them one at a time. This is a known, recurring problem in restricted environments — containers, CI runners, and platforms like Render/Replit/Streamlit Cloud where you don't control the base image and can't apt-install anything. playwright install --with-deps and playwright install-deps both shell out to apt-get install under the hood, which needs root. No root, no install, no browser. apt-get install needs root because it writes into /usr . But apt-get download — which just fetches a .deb file — doesn't need root at all, and dpkg-deb -x will happily unpack that .deb 's contents into any directory you own. So the fix is: npx playwright install-deps chromium --dry-run apt-get download each package listed dpkg-deb -x them into a local prefix, e.g. ~/.local/playwright-libs LD LIBRARY PATH Nothing touches /usr , nothing needs sudo, and deleting the prefix directory undoes all of it. Rather than re-run those steps by hand every time, I wrapped it into a small script that discovers the package list dynamically not hardcoded — it actually asks Playwright , downloads everything, wires up the library path, and verifies the browser launches: https://github.com/LooseChangeLabs/rootless-playwright https://github.com/LooseChangeLabs/rootless-playwright ./install.sh chromium It's MIT-licensed and free. If you're stuck with the same error, hopefully this saves you the trial-and-error I went through.