用于在 Droplet 上部署 Puppeteer Nodejs 应用程序的 Dockerfile 设置

编程入门 行业动态 更新时间:2024-10-08 14:49:10

用于在 Droplet 上部署 Puppeteer Nodejs <a href=https://www.elefans.com/category/jswz/34/1771452.html style=应用程序的 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 设置

本文发布于:2024-05-13 13:29:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1759627.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   Puppeteer   Droplet   Dockerfile   Nodejs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!