(Created on )

Puppeteer invalid Chrome version: numeric comparison input

Chrome build comparison received a release label instead of a numeric dotted build identifier.


Chrome build comparison received a release label instead of a numeric dotted build identifier.

Error message

Version {value} is not a valid Chrome version

{value} is replaced by the value shown in your error message.

How this error happens

A Chrome version comparator sorts resolved build identifiers. It cannot compare the unresolved labels stable and latest as numeric versions.

This example uses the standalone @puppeteer/browsers package.

import {
    Browser,
    BrowserPlatform,
    getVersionComparator,
    resolveBuildId,
} from "@puppeteer/browsers";

const compare = getVersionComparator(
    Browser.CHROME
);

compare(
    "stable",
    "latest"
);

How to fix

Resolve channel labels into build identifiers before comparing them.

const stableBuild = await resolveBuildId(
    Browser.CHROME,
    BrowserPlatform.LINUX,
    "stable"
);

const latestBuild = await resolveBuildId(
    Browser.CHROME,
    BrowserPlatform.LINUX,
    "latest"
);

const result = compare(
    stableBuild,
    latestBuild
);

console.log(result);

Things to keep in mind

Use the platform you actually target. Either comparison operand can fail the same validation; both cases belong in this one article.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →