puppeteer

How do you get Puppeteer to install the right version of Chrome?


I ran npx puppeteer browsers install chrome, and it responded with chrome@122.0.6261.111 /root/.cache/puppeteer/chrome/linux-122.0.6261.111/chrome-linux64/chrome.

Then I ran ts-node with some code that uses puppeteer, and I got this message:

Error: Could not find Chrome (ver. 127.0.6533.88). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or
 2. your cache path is incorrectly configured (which is: /root/.cache/puppeteer).

So why does npx puppeteer browsers install chrome install version 122.0.6261.111 when puppeteer actually needs version 127.0.6533.88? More importantly, how do I fix this? I tried npm install beforehand to make sure puppeteer was the right version.


Solution

  • Each Puppeteer version corresponds to a single Chrome version.

    In this case, the underlying code must have been somehow using the wrong Puppeteer version.

    To fix the problem, I just ran npm install puppeteer@latest to make sure the version was up to date.