abi / screenshot-to-code

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Home Page:https://screenshottocode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix Puppeteer error with Docker

LUT-hgy opened this issue · comments

"I encountered an error while deploying a Docker container, and the error log is as follows. Does this app require Puppeteer?"

[root@localhost app]# docker-compose up -d --build
WARN[0000] /root/app/docker-compose.yml: version is obsolete
[+] Building 58.7s (13/20) docker:default
=> [frontend internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 524B 0.0s
=> [frontend internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [backend internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 593B 0.0s
=> [backend internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [frontend internal] load metadata for docker.io/library/node:20.9-bullseye-slim 16.0s
=> [backend internal] load metadata for docker.io/library/python:3.12-slim-bullseye 16.0s
=> [backend internal] load build context 0.0s
=> => transferring context: 281.05kB 0.0s
=> CANCELED [backend 1/7] FROM docker.io/library/python:3.12-slim-bullseye@sha256:6fa552fb879325884b0c1b6792d14ae9500d246c8b19cc27876d84c7c41117ff 42.7s
=> => resolve docker.io/library/python:3.12-slim-bullseye@sha256:6fa552fb879325884b0c1b6792d14ae9500d246c8b19cc27876d84c7c41117ff 0.0s
=> => sha256:2cc675879443a6a443c2dd27873f2562780f7a7bee6cae8d27db63313b6bb22c 6.69kB / 6.69kB 0.0s
=> => sha256:728328ac3bde9b85225b1f0d60f5c149f5635a191f5d8eaeeb00e095d36ef9fd 17.83MB / 31.43MB 42.7s
=> => sha256:1b1ca9b4dc3e3a61667ce56aa8973a0f79300a0d2bc1c677608fca5a20a6e71c 1.08MB / 1.08MB 8.7s
=> => sha256:ff314948cd748157816b418ffb8d5a834c58552d2f147552adeda9ffbaacf9c6 10.49MB / 11.22MB 42.7s
=> => sha256:6fa552fb879325884b0c1b6792d14ae9500d246c8b19cc27876d84c7c41117ff 1.65kB / 1.65kB 0.0s
=> => sha256:11ee4eb9e164c0ff4aeb4eef37163aedc358f57045f394f719b8c130190a440d 1.37kB / 1.37kB 0.0s
=> => sha256:775eb0fca1f366c27e2eda6e40d178cd366d34d92171c3ca2fd10ec0b06c010e 244B / 244B 9.6s
=> => sha256:f7cb43d7355fa62d470ac0cb430951fb68529f463c217aa6911419c20286b436 3.06MB / 3.06MB 22.8s
=> [frontend 1/5] FROM docker.io/library/node:20.9-bullseye-slim@sha256:330fa0342b6ad2cbdab30ac44195660af5a1f298cc499d8cbdf7496b02ea17d8 0.0s
=> [frontend internal] load build context 0.0s
=> => transferring context: 820.63kB 0.0s
=> CACHED [frontend 2/5] WORKDIR /app 0.0s
=> CACHED [frontend 3/5] COPY package.json yarn.lock /app/ 0.0s
=> ERROR [frontend 4/5] RUN yarn install 41.8s

[frontend 4/5] RUN yarn install:
0.313 yarn install v1.22.19
0.362 [1/5] Validating package.json...
0.364 [2/5] Resolving packages...
0.557 [3/5] Fetching packages...
36.11 warning vscode-languageclient@7.0.0: The engine "vscode" appears to be invalid.
36.12 [4/5] Linking dependencies...
36.13 warning "react-hot-toast > goober@2.1.13" has unmet peer dependency "csstype@^3.0.10".
36.13 warning " > thememirror@2.0.1" has unmet peer dependency "@codemirror/language@^6.0.0".
36.13 warning " > thememirror@2.0.1" has unmet peer dependency "@codemirror/state@^6.0.0".
36.13 warning " > thememirror@2.0.1" has unmet peer dependency "@codemirror/view@^6.0.0".
40.37 [5/5] Building fresh packages...
41.26 error /app/node_modules/puppeteer: Command failed.
41.26 Exit code: 1
41.26 Command: node install.mjs
41.26 Arguments:
41.26 Directory: /app/node_modules/puppeteer
41.26 Output:
41.26 Error: ERROR: Failed to set up Chrome v123.0.6312.122! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
41.26 at file:///app/node_modules/puppeteer/lib/esm/puppeteer/node/install.js:58:23
41.26 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
41.26 at async Promise.all (index 0)
41.26 at async downloadBrowser (file:///app/node_modules/puppeteer/lib/esm/puppeteer/node/install.js:90:9) {
41.26 [cause]: Error: read ECONNRESET
41.26 at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
41.26 errno: -104,
41.26 code: 'ECONNRESET',
41.26 syscall: 'read'
41.26 }
41.26 }
41.26 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


failed to solve: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1

I recently added Puppeteer for doing end to end testing. It's not necessary for the app to just work. Can you remove Puppeteer from package.json and try again?

I need to fix the issue.

Thank you for your response. I removed the dependency on Puppeteer in the package.json file and added "ENV PUPPETEER_SKIP_DOWNLOAD=true" in the Dockerfile, which allowed the deployment to succeed.

Awesome, I'll try to include "ENV PUPPETEER_SKIP_DOWNLOAD=true" in the Dockerfile to see if this fixes it for everyone.