chromium: [BUG] The input directory "/var/bin" does not exist

Environment

  • chromium Version: 109.0.1
  • puppeteer / puppeteer-core Version: 19.4.0
  • Node.js Version: v18.12.0
  • Lambda / GCF Runtime: nodejs18.x

Expected Behavior

https://github.com/Sparticuz/chromium/issues/24#issuecomment-1366863330

Current Behavior

The input directory \"/var/bin\" does not exist.

Steps to Reproduce

const browser = await puppeteer.launch({
    args: chromium.args,
    defaultViewport: chromium.defaultViewport,
    executablePath: await chromium.executablePath("/var/bin"),
    headless: chromium.headless,
    ignoreHTTPSErrors: true,
  });

Possible Solution

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (5 by maintainers)

Most upvoted comments

Not sure if this is a hack or what but here’s how I made it work with AWS SAM:

  • Followed the instructions under AWS Lambda Layer from here.
  • Added a layer in my function’s template pointing to the layer just created in previous step
  • Added "puppeteer-core": "^19.6.0" and "@sparticuz/chromium": "^110.0.0" as dev dependencies
  • Pointed the executable path to here executablePath: await chromium.executablePath('/opt/nodejs/node_modules/@sparticuz/chromium/bin')

Hope this helps the next noob like myself trying to make this work.

I encountered a similar issue, and the solution was to exclude ‘@sparticuz/chromium’ from the bundled lambda. Here’s a code snippet using CDK:

bundling: {
  externalModules: ['aws-sdk', '@sparticuz/chromium'] // Add any external modules here
},

I think you need to reopen this issue, because this bug is permanently happening with all the possible hacks applied. @Sparticuz

Can confirm that #41 (comment) did the trick for me as well.

Randomly starting getting this error after a deploy, but specifying the chromium path fixed it