How to find the right CHROMIUM_REVISION value for a given chromium version

Marcin Wosinek - Aug 17 '21 - - Dev Community

If you use node-chromium for installing chromium, it can be really a headache to install the exact version. The official solution is to set:

$ export NODE_CHROMIUM_REVISION=729994
Enter fullscreen mode Exit fullscreen mode

But the problem is to map the application version (for example, 92.x) to the revision that can be successfully installed. If we fail to provide the right value, we will get an error similar to this one:

Step 1. Retrieving Chromium revision number
Step 2. Downloading Chromium revision 72999
Downloading Chromium - 0 MB [--------------------] 0% 0.0s An error occurred while trying to download file Response code 404 (Not Found)
An error occurred while trying to setup Chromium. Resolve all issues and restart the process HTTPError: Response code 404 (Not Found)
    at Request._onResponseBase (/home/marcin/workspace/github/chromium-install/node_modules/got/dist/source/core/index.js:899:31)
Enter fullscreen mode Exit fullscreen mode

Solution

So far, the best solution I found is to check https://npm.taobao.org/mirrors/chromium-browser-snapshots/, and pick the values shown for your platform. For example, for Linux, we have:

809590/                                           2020-10-23T15:36:20.890Z                          -
818858/                                           2020-11-16T13:59:10.648Z                          -
843427/                                           2021-02-02T11:18:32.464Z                          -
848005/                                           2021-02-03T15:50:06.496Z                          -
856583/                                           2021-02-26T08:47:06.448Z                          -
869685/                                           2021-04-21T11:32:14.871Z                          -
884014/                                           2021-05-31T12:43:15.851Z                          -
901912/                                           2021-08-04T12:55:01.223Z                          -
Enter fullscreen mode Exit fullscreen mode

By picking some of those values, I can install some past versions successfully:

$ NODE_CHROMIUM_REVISION=856583 
$ npm install chromium                

> chromium@3.0.2 postinstall /home/marcin/workspace/github/chromium-install/node_modules/chromium
> node install.js

Step 1. Retrieving Chromium revision number
Step 2. Downloading Chromium revision 856583
Downloading Chromium - 136.8 MB [====================] 100% 0.0s 
Step 3. Setting up Chromium binaries
Process is successfully finished
npm WARN chromium-install@1.0.0 No description
npm WARN chromium-install@1.0.0 No repository field.

+ chromium@3.0.2
updated 1 package and audited 67 packages in 28.403s
found 0 vulnerabilities
Enter fullscreen mode Exit fullscreen mode

After that, I can double-check what version was installed:

$ ./node_modules/chromium/lib/chromium/chrome-linux/chrome --version
Chromium 90.0.4427.0
Enter fullscreen mode Exit fullscreen mode

Summary

This article presents a quick & dirty solution to picking past chromium versions with node-chromium. Please share if you found some better solution.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .