我使用木偶和无头铬制作了一个抓取应用程序,并将其打包到docker映像中。
该容器在linux主机上运行良好,但是在运行wsl的Windows主机上,我得到了
错误:无法启动Chrome!
故障排除: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
在onClose(/home/app/node_modules/puppeteer/lib/Launcher.js:342:14)
在Interface.helper.addEventListener (/home/app/node_modules/puppeteer/lib/Launcher.js:331:50)
在Interface.emit(events.js:187:15)
在Interface.close(readline.js:379:8)
在Socket.onend(readline.js:157:10)
在Socket.emit(events.js:187:15)
在endReadableNT(_stream_visible.js:1081:12)
在process._tickCallback(内部/process/next_tick.js:63:19)
TypeError:无法读取未定义的属性“ length”
在/home/app/index.js:28:14
在process._tickCallback(内部/process/next_tick.js:68:7)
可以在dockerhub上找到图像
docker pull lonelydaoist/scraper-atlas:v1.0
运行容器
docker run --rm -e START_PAGE=40 -e END_PAGE=45 lonelydaoist/scraper-atlas:v1.0