alixaxel / chrome-aws-lambda

Chromium Binary for AWS Lambda and Google Cloud Functions
MIT License
3.2k stars 292 forks source link

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

Open shivika24 opened 2 years ago

shivika24 commented 2 years ago

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

Pablo1107 commented 2 years ago

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)"
  ]
}
buzzie-bee commented 2 years ago

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.

N3zTho commented 2 years ago

node node_modules/puppeteer/install.js

1596944197 commented 2 years ago

node node_modules/puppeteer/install.js

i think this answer is right

ikemura23 commented 1 year ago

I get it to work

node node_modules/puppeteer-core/install.js

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

frabbicse commented 1 year ago

It works for me. Thank you.

node node_modules/puppeteer/install.js

LordOfTheDings commented 1 year ago

node node_modules/puppeteer/install.js

Worked for me as well.

chirag0320 commented 1 year ago

node node_modules/puppeteer/install.js

but how to use this?

LordOfTheDings commented 1 year ago

node node_modules/puppeteer/install.js

but how to use this?

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

experionsachin commented 1 year ago

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.

leonardoviada commented 1 year ago

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

dasheck0 commented 1 year ago

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

Rynebenson commented 1 year ago

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

kurtsys commented 1 year ago

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?

NarsimhaRaj4 commented 9 months ago

@kurtsys found any solution ?

danielandreitubu commented 6 months ago

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?

mylonasg88 commented 3 months ago

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?

node node_modules/puppeteer/install.js

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

I am getting same error. This happened after I installed chai in my project.

ericsubirana commented 1 month ago

It works for me. Thank you.

node node_modules/puppeteer/install.js

It also may be useful using: > > node node_modules/puppeteer/install.mjs