puppeteer Centos 7 문제 해결

1. lib dependencies 해결

https://chrome.richardlloyd.org.uk/

2. sandbox 문제 해결

# cd to the downloaded instance
cd /node_modules/puppeteer/.local-chromium/linux-/chrome-linux/
sudo chown root:root chrome_sandbox
sudo chmod 4755 chrome_sandbox
# copy sandbox executable to a shared location
sudo cp -p chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
# export CHROME_DEVEL_SANDBOX env variable
export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox

2-1. 코드 변경
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});

fun crawling ^^

참조
https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

https://intoli.com/blog/installing-google-chrome-on-centos/

This entry was posted in nodejs. Bookmark the permalink.

Leave a comment