[공지] SMS114.CO.KR 바로가기
www.sms114.co.kr
👉 텔레그램 상담 바로가기

최대 1 분 소요

1. Chrome을 수동으로 설치하는 방법 (Amazon Linux 2023)

AL2023에서는 dnf 저장소에 google-chrome-stable 패키지가 없다. 해서, 그래서 직접 Google에서 최신 Chrome을 다운로드해서 설치해야 한다.

cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo dnf install -y ./google-chrome-stable_current_x86_64.rpm

//설치확인
google-chrome --version
=> Google Chrome 133.0.6943.53


2. Puppeteer 실행할 때 executablePath 수정

설치된 Chrome 경로를 젇ㅇ확히 ** Puppeteer 스크립트(screen4.js)** 에 추가해야 함.

const puppeteer = require('puppeteer-core');

(async () => {
    const browser = await puppeteer.launch({
        headless: false,  // 창을 띄우려면 false, 백그라운드 실행은 true
        executablePath: '/usr/bin/google-chrome',  // 여기 Chrome 경로 설정!
        args: ['--no-sandbox', '--disable-setuid-sandbox']
    });

    const page = await browser.newPage();
    await page.goto('https://www.google.com');
    console.log('페이지 로드 완료!');
    await browser.close();
})();

💡 만약 which google-chrome을 실행했는데 /usr/bin/google-chrome이 아니라 다른 경로가 나온다면, 그걸 executablePath에 넣어주면 된다.!

댓글남기기