-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-plugin-preload-fonts] Make puppeteer script compatible with Alpine #21778
Comments
The following code makes it possible to set Allows to start script like this: const processArgs = process.argv.slice(2)
const isExecutablePathArg = arg => arg.includes("executable-path")
const executablePathArg = processArgs.find(isExecutablePathArg)
const [,executablePath] = executablePathArg ? executablePathArg.split("=") : [undefined, undefined]
const args = processArgs.filter(arg => !isExecutablePathArg(arg))
const browser = await puppeteer.launch({
executablePath,
args
}); |
hello @nibtime, excellent work, thank you! |
According to those docs: https://pptr.dev/#?product=Puppeteer&version=v1.20.0&show=api-environment-variables you should be able to use (docs for [email protected] because that's version we use in the plugin -
|
Thanks @pieh, that works! |
Summary
I installed
gatsby-plugin-preload-fonts
and tried to start the crawler script. I got some output that looked like this:I am developing with Gatsby inside a VS Code Remote Container based on Alpine. The problem seems to be, that puppeteer does not download a musl version of Chromium. I've installed Chromium for Alpine though, but puppeteer does not use it.
The problem could be mitigated by making the
executablePath
ofpuppeteer.launch
a parameter of the script.Basic example
Puppeteer can be pointed to the correct Chromium path (see here)
To work around the problem, I made the following replacement: in
prepare/index.js
in thenode_modules
folder:Motivation
This would make the plugin usable with Alpine Linux. Also I think this should be documented somehow, even if it is just this issue.
The text was updated successfully, but these errors were encountered: