I recently added react-snap to prerender dynamic content in my React app for SEO and embeds. This, however, breaks the build. It fails with:
Error: Failed to launch chrome!
/vercel/path0/web/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
I assume this means puppeteer isn’t fully configured, but I don’t know how to install the dependencies it needs otherwise. The updates on this similar issue hint that Vercel now supports running puppeteer at build time, but that isn’t what I’m seeing here.
I’ve also tried running ldd chrome | grep not
in package.json
"postbuild"
according to the puppeteer troubleshooting docs to get the dependencies and install them before react-snap
, but the build env can’t find chrome, so it fails on ldd chrome
.
Am I missing a configuration somewhere that will properly resolve this build issue?
Edit: I’ve also found this stack overflow thread that mentions a number of possible options. I’m still running through them, but currently the node version is a nonstarter, I can’t even configure the app to use node 14.x and using anything higher seems to fail anyways.