Puppeteer: No platform specified. Couldn't auto-detect browser platform.
No platform was supplied and platform detection failed.
No platform was supplied and platform detection failed.
Error message
No platform specified. Couldn't auto-detect browser platform.
How this error happens
computeExecutablePath needs a platform to calculate a browser’s relative executable path. With no platform on an unsupported host, it cannot build that path.
The failing snippet assumes an unsupported host. The fix continues with the imports from the first snippet.
import {
Browser,
computeExecutablePath,
} from "@puppeteer/browsers";
const executable = computeExecutablePath({
cacheDir: null,
browser: Browser.CHROME,
buildId: "example-build",
});
How to fix
Supply the platform of the browser artifact you are inspecting.
import {
BrowserPlatform,
} from "@puppeteer/browsers";
const executable = computeExecutablePath({
cacheDir: null,
browser: Browser.CHROME,
platform: BrowserPlatform.LINUX,
buildId: "example-build",
});
console.log(executable);
Things to keep in mind
This only computes a path. It neither downloads the build nor makes a foreign-platform executable runnable.