Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (901912). #40

Closed
guhyeon opened this issue Aug 6, 2022 · 8 comments · Fixed by #42
Assignees
Labels
bug Something isn't working

Comments

@guhyeon
Copy link

guhyeon commented Aug 6, 2022

Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (901912).

when build example and start, errors are occurred.
'npm run dev' is ok, but 'npm run build' and 'npm run start' has problem.

reproduce steps

  1. clone this project
  2. npm install
  3. cd example && npm install

after I encountered errors bellow
`It looks like you're trying to use TypeScript but do not have the required package(s) installed.

Please install @types/react by running:`

so i installed @types/react and upgrade next, react
4. npm install --save-dev @types/react && npm install next@latest && npm upgrade react@latest react-dom@latest

  1. npm build && npm start
  2. browser open and go to url http://localhost:3000/api/basic?myQueryParam=asdf
@kamenskiyyyy
Copy link

I also have this problem, but only on production

@mvandergrift
Copy link

Same here. Works with dev build, but puppeteer-core cannot find chromium in the production build.

@neg4n neg4n added the bug Something isn't working label Sep 10, 2022
@neg4n neg4n self-assigned this Sep 10, 2022
@neg4n
Copy link
Owner

neg4n commented Sep 10, 2022

Hey folks @guhyeon @kamenskiyyyy @mvandergrift

The problem is probably only occurring during production app runtime on the local machine since when NODE_ENV is set to production and the library tries to load chrome from chrome-aws-lambda package instead of retrieving chromium path from the local machine.

I'll try to do something like detecting if the code is run on AWS to solve this

Cheers. Igor

@kamenskiyyyy
Copy link

@neg4n I found a solution https://github.com/kamenskiyyyy/open-graph-image-example. You just need to remove chrome-aws-lambda.

@neg4n
Copy link
Owner

neg4n commented Sep 11, 2022

@neg4n I found a solution https://github.com/kamenskiyyyy/open-graph-image-example. You just need to remove chrome-aws-lambda.

@kamenskiyyyy

Im afraid that this can't be solved like this 😔 Only when hosting/running the next-api-og-image is done on the machine where you have direct access to the physical resources (servers, local hosting) does the problem solve with your solution applied. However, doing so will most likely break library's support for being deployed in the cloud 😭

@neg4n neg4n linked a pull request Sep 13, 2022 that will close this issue
@neg4n neg4n closed this as completed in #42 Sep 13, 2022
@neg4n
Copy link
Owner

neg4n commented Sep 13, 2022

Hey folks @guhyeon @mvandergrift @kamenskiyyyy

https://github.com/neg4n/next-api-og-image/releases/tag/4.2.2 🚀

Thanks for your contributions, feel free to continue the topic if problem still persists 😄

@65536william
Copy link

65536william commented Sep 15, 2022

Serving my Next.js app on DigitalOcean, I'm getting this error after updating to 4.2.2:

Error: Failed to launch the browser process! spawn /usr/bin/google-chrome ENOENT
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
  at onClose (/workspace/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
  at ChildProcess.<anonymous> (/workspace/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:189:85)
  at ChildProcess.emit (node:events:513:28)
  at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
  at onErrorNT (node:internal/child_process:478:16)
  at processTicksAndRejections (node:internal/process/task_queues:83:21)

@njoguamos
Copy link

Serving my Next.js app on DigitalOcean, I'm getting this error after updating to 4.2.2:

@wjeliot refer to this discussion, it might help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants