본문 바로가기
IT/Programing Tip

우분투(Ubuntu) puppeteer 실행시 에러날때 (libX11-xcb.so)

by DOSGamer 2018. 12. 23.
반응형

에러코드

 

error while loading shared libraries: libX11-xcb.so: cannot open shared object file: No such file or directory

 

원인
puppeteer 에서 사용하는 chrome 브라우저를 실행시킬 라이브러리가 우분투 OS 에서는 부족해서 실행이 안된다

 

 

해결방법
필요한 라이브러리를 설치해준다
 
sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

 

해결 후 확인결과
 
//index.js puppeteer.launch( ).then(async browser => { const page = await browser.newPage(); await page.goto('https://www.google.com'); const title = await page.title() console.log(title) await browser.close(); });

 

실행결과
 

 

 
 
반응형