Yêu cầu thg 2 25, 2021 2:44 SA 280 0 2
  • 280 0 2
0

Config puppeteer khi deploy project Nodejs trên Elastic Beanstalk AWS

Chia sẻ
  • 280 0 2

Project mình có sửa dụng puppeteer, khi mình chạy ở Local thì OK. nhưng khi deploy trên Elastic Beanstalk AWS thì khi chạy đến code sử dụng puppeteer thì có log lỗi này:

Error: Failed to launch the browser process!

/var/app/current/node_modules/puppeteer/.local-chromium/linux-848005./chrome-linux/chrome: error while loading shared libraries: libxkbcommon.so.0: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

at onClose (/var/app/current/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)

at Interface.<anonymous> (/var/app/current/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)

at Interface.emit (events.js:323:22)

at Interface.close (readline.js:409:8)

at Socket.onend (readline.js:187:10)

at Socket.emit (events.js:323:22)

at endReadableNT (_stream_readable.js:1204:12)

at processTicksAndRejections (internal/process/task_queues.js:84:21)

environment mình sử dụng

Puppeteer version: 7.1.0

Platform / OS version: Linux on Elastic Beanstalk AWS

Node.js version: 12.16.1

đọan code

const browser = await puppeteer.launch({
        headless: true,
        args: ['--no-sandbox', '--disable-setuid-sandbox']
    });

Mọi người đã gặp case này chưa ạ? giúp mình với. thanks all

2 CÂU TRẢ LỜI


Đã trả lời thg 2 25, 2021 2:46 SA
+1

Bạn đã install chromium chưa ?

Chia sẻ
thg 2 25, 2021 4:38 SA

@hoaidien93 mình nghĩ cho đang thiếu package như bạn @ruacondepzaj nói. Nhưng mình chưa biết cài như thế nào? bạn biết chỉ giúp mình với>.

Đã trả lời thg 2 25, 2021 2:47 SA
+1

Do bạn cài thiếu package đó: Ví dụ mình có cài thêm libxtst6 libxss1 thì sẽ k bị lỗi nữa

apt-get install -y google-chrome-stable libxtst6 libxss1
Chia sẻ
thg 2 25, 2021 3:06 SA

@ruacondepzaj cài trên AWS hay cài ở đâu bạn nhỉ? lần đầu mình sử dụng EB AWS nên còn bỡ ngỡ. mong bạn chỉ giúp

thg 2 25, 2021 4:36 SA

@ruacondepzaj bạn ơi, chạy câu lệnh này ở đâu và như thế nào vậy, chỉ mình với.

Avatar Nguyễn Văn Quy @ruacondepzaj
thg 2 26, 2021 1:43 SA

@bt36 Bạn phải SSH vào server AWS ms cài đc bằng command bạn a

Avatar Nguyễn Văn Quy @ruacondepzaj
thg 2 26, 2021 1:45 SA
thg 3 1, 2021 8:47 SA

@ruacondepzaj cảm ơn ban nhé, mình SSH vào server và đã cài được những package còn thiếu rồi. code chạy ok rồi.

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí