chrome-aws-lambda icon indicating copy to clipboard operation
chrome-aws-lambda copied to clipboard

Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (938248).[BUG]

Open shivika24 opened this issue 2 years ago • 16 comments

Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (938248). When using serverless-esbuild plugin with puppeteer.

shivika24 avatar Jan 18 '22 12:01 shivika24

I have the same error.

{
  "errorType": "Error",
  "errorMessage": "Error in handler:  Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (961656).",
  "trace": [
    "Error: Error in handler:  Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (961656).",
    "    at Runtime.module.exports.hello [as handler] (/var/task/handler.js:42:11)"
  ]
}

Pablo1107 avatar Feb 25 '22 19:02 Pablo1107

I had the same error. It seems it's because running this locally requires some additional steps: https://github.com/alixaxel/chrome-aws-lambda/wiki/HOWTO:-Local-Development

This explains why the chromium.executablePath is null, as it is not running in the lambda environment.

It's a seperate problem but now I'm seeing VAAPI video acceleration not available for swiftshader errors when trying to run the instance.

buzzie-bee avatar Mar 04 '22 16:03 buzzie-bee

node node_modules/puppeteer/install.js

N3zTho avatar Jul 28 '22 04:07 N3zTho

node node_modules/puppeteer/install.js

i think this answer is right

1596944197 avatar Sep 14 '22 03:09 1596944197

I get it to work

node node_modules/puppeteer-core/install.js

version : "chrome-aws-lambda": "^10.1.0"

ikemura23 avatar Nov 20 '22 23:11 ikemura23

It works for me. Thank you.

node node_modules/puppeteer/install.js

frabbicse avatar Nov 29 '22 08:11 frabbicse

node node_modules/puppeteer/install.js

Worked for me as well.

LordOfTheDings avatar Jan 03 '23 00:01 LordOfTheDings

node node_modules/puppeteer/install.js

but how to use this?

chirag0320 avatar Feb 12 '23 06:02 chirag0320

node node_modules/puppeteer/install.js

but how to use this?

You execute the js file. Just copy paste the command into your console.

LordOfTheDings avatar Feb 12 '23 13:02 LordOfTheDings

Give this a try. This is one of the latest maintained repositories: https://www.npmjs.com/package/@sparticuz/chromium. Working well with node 18 and AWS Lambda.

experionsachin avatar Mar 23 '23 21:03 experionsachin

Give this a try. This is one of the latest maintained repositories: https://www.npmjs.com/package/@sparticuz/chromium. Working well with node 18 and AWS Lambda.

 ~/WebstormProjects/map-ts-gen/ [main+*] serverless invoke local --function mapgen -p data.json

Running "serverless" from node_modules
Compiling with Typescript...
Using local tsconfig.json - tsconfig.json
Typescript compiled.
{
    "errorMessage": "spawn Unknown system error -8",
    "errorType": "Error",
    "stackTrace": [
        "Error: spawn Unknown system error -8",
        "    at ChildProcess.spawn (node:internal/child_process:413:11)",
        "    at Object.spawn (node:child_process:757:9)",
        "    at childProcess.spawn (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/cli-progress-footer/lib/private/cli-progress-footer/disable-props.js:73:50)",
        "    at new Process (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/@puppeteer/browsers/lib/cjs/launch.js:143:87)",
        "    at launch (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/@puppeteer/browsers/lib/cjs/launch.js:80:12)",
        "    at ChromeLauncher.launch (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:90:54)",
        "    at async mapgen (/Users/leonardoviada/WebstormProjects/map-ts-gen/.build/handler.js:47:21)"
    ]
}

This is the instantiation code

const browser = await puppeteer.launch({
        args: chromium.args,
        defaultViewport: chromium.defaultViewport,
        executablePath: await chromium.executablePath(),
        headless: chromium.headless,
    });

I'm getting this error after switching to @sparticuz/chromium

leonardoviada avatar Apr 13 '23 13:04 leonardoviada

So I run this command on the aws lambda instance? When I run this locally this seems to be a version tailored to my OS, which is different to the one that runs on aws lambda. Note that I do not use this locally but on a lambda instance (as the name of the package suggests). Thanks for any help

dasheck0 avatar May 11 '23 15:05 dasheck0

Give this a try. This is one of the latest maintained repositories: https://www.npmjs.com/package/@sparticuz/chromium. Working well with node 18 and AWS Lambda.

 ~/WebstormProjects/map-ts-gen/ [main+*] serverless invoke local --function mapgen -p data.json

Running "serverless" from node_modules
Compiling with Typescript...
Using local tsconfig.json - tsconfig.json
Typescript compiled.
{
    "errorMessage": "spawn Unknown system error -8",
    "errorType": "Error",
    "stackTrace": [
        "Error: spawn Unknown system error -8",
        "    at ChildProcess.spawn (node:internal/child_process:413:11)",
        "    at Object.spawn (node:child_process:757:9)",
        "    at childProcess.spawn (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/cli-progress-footer/lib/private/cli-progress-footer/disable-props.js:73:50)",
        "    at new Process (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/@puppeteer/browsers/lib/cjs/launch.js:143:87)",
        "    at launch (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/@puppeteer/browsers/lib/cjs/launch.js:80:12)",
        "    at ChromeLauncher.launch (/Users/leonardoviada/WebstormProjects/map-ts-gen/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:90:54)",
        "    at async mapgen (/Users/leonardoviada/WebstormProjects/map-ts-gen/.build/handler.js:47:21)"
    ]
}

This is the instantiation code

const browser = await puppeteer.launch({
        args: chromium.args,
        defaultViewport: chromium.defaultViewport,
        executablePath: await chromium.executablePath(),
        headless: chromium.headless,
    });

I'm getting this error after switching to @sparticuz/chromium

Did you ever solve this? I'm been trying to solve this for 3+ hours and haven't had any success

Rynebenson avatar May 20 '23 23:05 Rynebenson

node node_modules/puppeteer/install.js

but how to use this?

You execute the js file. Just copy paste the command into your console.

That works locally (telling me the browser is already installed):

➜ git:(main) node node_modules/puppeteer/install.js

Chromium is already in [...]/node_modules/puppeteer/.local-chromium/mac-901912; skipping download.

Still, the error remains on AWS lambda. I can't run that command there, or can I?

kurtsys avatar Jun 23 '23 07:06 kurtsys

@kurtsys found any solution ?

NarsimhaRaj4 avatar Dec 21 '23 10:12 NarsimhaRaj4

node node_modules/puppeteer/install.js

but how to use this?

You execute the js file. Just copy paste the command into your console.

That works locally (telling me the browser is already installed):

➜ git:(main) node node_modules/puppeteer/install.js

Chromium is already in [...]/node_modules/puppeteer/.local-chromium/mac-901912; skipping download.

Still, the error remains on AWS lambda. I can't run that command there, or can I?

did you solve this?

danielandreitubu avatar Mar 08 '24 03:03 danielandreitubu