应用程序的 Dockerfile 设置"/>
用于在 Droplet 上部署 Puppeteer Nodejs 应用程序的 Dockerfile 设置
我已经用尽了 stackoverflow 上所有可能的解决方案,但没有成功。
我的用例是一个非常简单的 nodejs 应用程序,它使用 puppeteer ^19.7.1
.
我的目录结构有文件 .puppeteerrc.cjs
内容
const { join } = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
但是,当服务器启动时,我不断收到错误消息:
/workspace/.cache/puppeteer/chrome/linux-1069273/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
在我的本地主机上一切正常。只有当我将它托管在 Digital Ocean Droplets 上时,问题才会出现。
我尝试在此处复制 Dockerfile 设置 /troubleshooting#running-puppeteer-in-the-cloud 到我的项目的根目录,看看问题是否会得到解决可用。
所以,如果有人可以帮助我进行有效的 Dockerfile 配置来解决这个问题,我将不胜感激,因为我已经花了一整天的时间来解决这个问题。
我打算在 Digital Ocean 的 Droplets 上托管该应用程序
感谢您的期待
回答如下:更多推荐
用于在 Droplet 上部署 Puppeteer Nodejs 应用程序的 Dockerfile 设置
发布评论