[Bug]: Chromium doesn't install with Yarn 3.3.0 ("Error: Could not find Chromium")
See original GitHub issueBug description
Steps to reproduce the problem:
Reduced test case repo is here: https://github.com/davidcalhoun/puppeteer-yarn-postinstall-bug
mkdir puppetteer-yarn-test && cd puppetteer-yarn-test
(create a new directory)yarn init
, then hit enter to all the prompts to accept all the defaults. This will initialize a new project.- Open
package.json
and add"type": "module"
(needed for using ES Modulesimport
syntax intest.js
below). yarn set version stable
(upgrades from Yarn 1 to Yarn 3)touch .puppeteerrc.cjs
and use your editor (e.g.nano .puppeteerrc.cjs
) to copy in the recommended config for Puppeteer 19 from the Puppeteer docs.yarn add --dev puppeteer
touch test.js
and use your editor to copy in the search example code.yarn node test.js
Notice on step 6 that Yarn mentions it needs to build Puppeteer (assuming it’s running Puppeteer’s postinstall
script), but it completes suspiciously fast:
...
// Puppeteer 19 - it doesn't seem to be doing anything here, and Chromium never installs
➤ YN0000: ┌ Link step
➤ YN0007: │ puppeteer@npm:19.2.2 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 0s 727ms
...
Also note that no files are present in the expected path ./cache/puppeteer
which we defined in .puppeteerrc.cjs
on step 5.
Workaround
Downgrading to Puppeteer 17 as mentioned here works:
yarn remove puppeteer
yarn add --dev puppeteer@~17.1.3
yarn node test.js
Notice with Puppeteer 17 that the postinstall
seems to do actually be doing something as expected. It takes ~9 seconds on my machine, versus <1 second on Puppeteer 19 (probably a no-op?):
...
// Puppeteer 17 output - it successfully takes the time to install Chromium
➤ YN0000: ┌ Link step
➤ YN0007: │ puppeteer@npm:17.1.3 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 9s 366ms
...
Puppeteer version
19.2.2
Node.js version
16.16.0
npm version
npm 9.1.1 and yarn 3.3.0
What operating system are you seeing the problem on?
macOS
Configuration file
/**
* Copied from recommended Puppeteer v19 config found at
* https://pptr.dev/guides/configuration#changing-the-default-cache-directory
*/
const {join} = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
Relevant log output
dcalhoun@Davids-MBP-2 puppeteer-yarn-postinstall-bug % yarn node test.js
file:///Users/dcalhoun/dev/puppeteer-yarn-postinstall-bug/.yarn/cache/puppeteer-core-npm-19.2.2-830fad0e0f-5d27545666.zip/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:94
throw new Error(`Could not find Chromium (rev. ${this.puppeteer.browserRevision}). This can occur if either\n` +
^
Error: Could not find Chromium (rev. 1056772). This can occur if either
1. you did not perform an installation before running the script (e.g. `npm install`) or
2. your cache path is incorrectly configured (which is: /Users/dcalhoun/dev/puppeteer-yarn-postinstall-bug/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
at ChromeLauncher.resolveExecutablePath (file:///Users/dcalhoun/dev/puppeteer-yarn-postinstall-bug/.yarn/cache/puppeteer-core-npm-19.2.2-830fad0e0f-5d27545666.zip/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:94:27)
at ChromeLauncher.executablePath (file:///Users/dcalhoun/dev/puppeteer-yarn-postinstall-bug/.yarn/cache/puppeteer-core-npm-19.2.2-830fad0e0f-5d27545666.zip/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:160:25)
at ChromeLauncher.launch (file:///Users/dcalhoun/dev/puppeteer-yarn-postinstall-bug/.yarn/cache/puppeteer-core-npm-19.2.2-830fad0e0f-5d27545666.zip/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:64:37)
at async file:///Users/dcalhoun/dev/puppeteer-yarn-postinstall-bug/test.js:4:19
Issue Analytics
- State:
- Created 10 months ago
- Comments:5
Top Results From Across the Web
Fails with Unexpected error: Chromium revision is not ... - GitHub
error : Unexpected error: Chromium revision is not downloaded. Run "npm install" or "yarn install" debug: Error: Chromium revision is not downloaded.
Read more >47211 - Startup error: Could not find exported function ...
I'm running Windows 7 x64 and installed Windows Updates today. It was KB980846, KB982519, KB982526 and KB981078. Renaming the "User data" folder does...
Read more >node.js - Puppeteer Error: Chromium revision is not downloaded
I only managed to fix the issue by manually installing Chromium after much searching and trying most of the suggestions:
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug :1523 - "[IDEA] Offload work by distributing trivial ebuild maintenance to ... Bug:170292 - "dev-util/eclipse-sdk cannot find tomcat server binaries" ...
Read more >Problem with Google Chrome popup windows
Interestingly, Microsoft Edge (another chromium fork) does not suffer from this bug. I agree with level420 that disabling 3D acceleration is not acceptable ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It looks like the download might be failing? If you run the installation with the env var
DEBUG=puppeteer:*
you should see where Puppeteer attempts downloading the binary to (not sure if yarn would send the logs to stdout but works with npm).I’m no longer able to reproduce, I think you may be right about some transitory network issue with the test repro. I was still experiencing issues with an existing Yarn monorepo project where I was migrating from Puppeteer 15 to 19. I was able to fix it by moving
.puppeteerrc.cjs
to the monorepo root and also completely removing the.yarn
directory and reinstalling everything withyarn install
, where it finally ran the postinstall script correctly and downloaded Chromium!Thanks for your fast replies, I’ll close this one out!