我收到 504 网关超时错误,这是在这里问的: 但是没有解决办法。
我在 Centos 7 上运行它。
我已经安装了 Puppeteer JS Centos 7 推荐的所有软件包。
try {
browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] })
const page = await browser.newPage();
await page.goto('https://www.freecodecamp.org/');
await browser.close();
res.send('it launched 94!')
} catch (e) {
res.send(`got an error ${e}`);
console.info("Unable to launch browser mode in sandbox mode. Lauching Chrome without sandbox.");
}
我从来没有打过
res.send('it launched')
,我也没有得到catch block.
日志报告:
6466/Tc age/Cor/App/Gro/SessionManagement.cpp:330: Session checked out from process (pid=27554, group=/var/www/vhosts/inkto.art/preview.inkto.art (production))
知道我错过了什么吗?
Package.json
"dependencies": {
"body-parser": "1.20.1",
"cookie-parser": "^1.4.4",
"debug": "~4.1.1",
"express": "^4.18.2",
"morgan": "~1.9.1",
"node-html-to-image": "^3.3.0",
"nodemon": "^2.0.2",
"pug": "^3.0.2",
"puppeteer": "^19.11.1",
"resolve-path": "^1.4.0",
"serve-favicon": "~2.5.0"
}
在 CentOS Linux 7.9.2009 (Core) 上运行的服务器。
我按照 Puppeteer JS 的 yum 安装说明进行操作。