puppeteer: When I pkg my file and include puppeteer in my dependencies I get an error when I run my application.

I am using just regular puppeteer not puppeteer-core. How do I properly add puppeteer to my pack.json dependencies so I wont get this error when running it in my terminal?

(node:36178) UnhandledPromiseRejectionWarning: Error: Could not find browser revision 800071. Run "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.
    at ChromeLauncher.launch (/Users/ethan/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js:86:23)
    at async getArtist (/Users/ethan/Documents/html-js/SoundCloud-Terminal/searchArtist.js:13:21)
    at async /Users/ethan/Documents/html-js/SoundCloud-Terminal/searchArtist.js:57:23
(node:36178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:36178) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 16
  • Comments: 17

Most upvoted comments

Using example of github action here https://github.com/marketplace/actions/puppeteer-headful

was able to run in docker container providing

browser = await puppeteer.launch({
  executablePath: process.env.PUPPETEER_EXEC_PATH, // set by docker container
  headless: false,
  ...
});

Dockerfile entrypoint.sh: export PUPPETEER_EXEC_PATH=“google-chrome-stable”

Has anyone else had other solutions come to mind besides reinstalling node modules? I’ve seen a couple cases of this arising via Docker runs, and haven’t had any success with node_modules removal and reinstall.

<del>Same problem here. I also noticed that the command npm i puppeteer installs puppeteer but not chromium. I’m missing folder node_modules\puppeteer\ .local-chromium. This is happening only on Ubuntu on Digital Ocean. Locally on Windows is everything fine.</del>

Ok, the problem in my case was because of permission. When installing npm packages I used sudo npm install and it worked.