4

Otherwise, when I try to run tests using Puppeteer, I get Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"

It would seem that npm i with Puppeteer in my deps would be enough, but after install completes, I need to cd into /node_modules/puppeteer then run node install.js to get the correct revision downloaded.

When I do initial npm i I see

> puppeteer@1.13.0 install /Users/.../node_modules/puppeteer
> node install.js

Downloading Chromium r549031 - 76 Mb [====================] 100% 0.0s
Chromium downloaded to /Users/.../node_modules/puppeteer/.local-chromium/mac-549031

But this doesn't work and I get the revision error.

After I node install.js in Puppeteer's dir, I see

Downloading Chromium r637110 - 85.9 Mb [====================] 100% 0.0s
Chromium downloaded to /Users/.../node_modules/puppeteer/.local-chromium/mac-637110

then I am good to go.

Any ideas why? This is on macOS & Node 10.15 and I assume it's going to be more difficult to do this in CI.

I have searched around and found others with this problem, but no solid ways around this.

package.json

    "devDependencies": {
        "@babel/core": "^7.3.3",
        "@babel/preset-env": "^7.3.1",
        "babel-jest": "^24.1.0",
        "babel-loader": "^8.0.5",
        "eslint": "^5.14.1",
        "html-webpack-plugin": "^3.2.0",
        "husky": "1.1.2",
        "jest": "^24.1.0",
        "jest-puppeteer": "^4.1.0",
        "lint-staged": "7.3.0",
        "prettier-eslint-cli": "4.7.1",
        "puppeteer": "^1.13.0",
        "webpack": "^4.29.5",
        "webpack-bundle-analyzer": "^3.1.0",
        "webpack-cli": "^3.2.3",
        "webpack-dev-server": "^3.2.1",
        "webpack-shell-plugin": "^0.5.0"
    },
Jazzy
  • 6,029
  • 11
  • 50
  • 74

5 Answers5

7

I only managed to fix the above issue by manually installing Chromium using the below command on the command line

node node_modules/puppeteer/install.js
Afshin Ghazi
  • 2,784
  • 4
  • 23
  • 37
1

Here are some steps to potentially resolve this issue,

  • Try using puppeteer as dependency rather than devDependency.
  • remove any lock file like yarn.lock and package-lock.json
  • clean npm cache forcefully npm cache clean --force
  • clean yarn cache (if yarn is installed) yarn cache clean
  • Now that all cached data is gone, you can feel free to run npm install again.
  • If this produces the same error you faced previously, try using yarn.
  • If that does not fix the error, then try installing exact puppeteer version with yarn add puppeteer@1.13.0 instead of ^.

You do not have to go inside node_modules folder, and you do not have to follow above steps all the time, it's just the cache might be broken somewhere.

Md. Abu Taher
  • 17,395
  • 5
  • 49
  • 73
  • 1
    Thanks for your answer. I have actually tried all of these steps (I did again just now) and have the same results. I agree this is not how it's supposed to work, but it's the issue I am hitting. – Jazzy Mar 20 '19 at 20:06
  • See this issue https://github.com/GoogleChrome/puppeteer/issues/3588#issuecomment-444169087 – Jazzy Mar 20 '19 at 20:10
0

Unfortunately, another module's package.json had added puppeteer_chromium_revision to my .npmrc and was effectively hardcoding a revision for Puppeteer.

Jazzy
  • 6,029
  • 11
  • 50
  • 74
0

Following steps worked for me:

  • Removed lock file(like yarn.lock and package-lock.json)
  • Cleaned npm cache forcefully (npm cache clean --force / yarn cache clean)
  • Ran npm install
Meghnath Das
  • 145
  • 1
  • 6
0

I was installing puppeteer on an Ubuntu server and using npm install didn't work. I installed Yarn, and used that instead. It worked.

Dan Zuzevich
  • 3,651
  • 3
  • 26
  • 39