[英]Puppeteer will not open chrome (getting error)
I am running an elastic-beanstalk instance on AWS and am trying to build a pdf export functionality on a dashboard using Puppeteer.我正在 AWS 上运行一个 elastic-beanstalk 实例,并尝试使用 Puppeteer 在仪表板上构建 pdf 导出功能。 I got the application to work locally, however when i run the export feature on the cloud i get the following error.
我让应用程序在本地工作,但是当我在云上运行导出功能时,出现以下错误。
(node:1434) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
(节点:1434)未处理的PromiseRejectionWarning:错误:无法启动chrome! /var/app/current/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome: error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory
/var/app/current/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome:加载共享库时出错:libXcursor.so.1:无法打开共享对象文件:没有这样的文件或目录
To deploy i am zipping the contents of the application (without the node modules fails upload if included) and deploying on the following configuration:要部署,我正在压缩应用程序的内容(如果包含节点模块,则上传失败)并在以下配置上进行部署:
Environment tier:
Web Server
Platform:
Node.js running on 64bit Amazon Linux/4.10.1
Health status:
Ok
I had struggled to get the application to deploy until i included a .npmrc
file.在我包含一个
.npmrc
文件之前,我一直在努力部署应用程序。 However now i am having trouble running the functionality.但是现在我无法运行该功能。
看起来您缺少一些 Debian 依赖项,希望此链接有帮助。
GitHub repository maintained @ https://github.com/amarinediary/Marionette .
GitHub 存储库维护 @ https://github.com/amarinediary/Marionette 。 The following might not be up to date.
以下内容可能不是最新的。 Refer to the GitHub link for a maintained version.
有关维护版本,请参阅 GitHub 链接。
You can add AWS Elastic Beanstalk configuration files ( .ebextensions
) to your web application's source code to configure your environment and customize the AWS resources that it contains.您可以将 AWS Elastic Beanstalk 配置文件 (
.ebextensions
) 添加到您的 Web 应用程序的源代码中,以配置您的环境并自定义其中包含的 AWS 资源。
In our case, if we don't enable EPEL and if we continue installing Chromium as part of npm install, Puppeteer cannot launch Chromium due to unavailability of libatk-1.0.so.0
.在我们的例子中,如果我们不启用EPEL并且如果我们继续安装 Chromium 作为 npm install 的一部分,由于
libatk-1.0.so.0
不可用,Puppeteer 无法启动 Chromium。
Add the following to your app root:将以下内容添加到您的应用根目录:
.npmrc
file..npmrc
文件。.npmrc
file:.npmrc
文件中:unsafe-perm=true
The .npmrc
file defines how npm should behave when running commands. .npmrc
文件定义了 npm 在运行命令时的行为方式。 Setting unsafe-perm
to true
suppress the UID/GID switching when running package scripts.将
unsafe-perm
设置为true
在运行包脚本时抑制 UID/GID 切换。 Set the unsafe-perm flag to run scripts with root privileges.设置 unsafe-perm 标志以使用 root 权限运行脚本。
.ebextensions
folder..ebextensions
文件夹。.ebextensions
folder, create a 01_enableEPEL.config
file and add the following..ebextensions
文件夹中,创建一个01_enableEPEL.config
文件并添加以下内容。commands:
01_enableEPEL:
command: sudo amazon-linux-extras install epel -y
.ebextensions
folder, create a 02_installEPELPackages.config
file and add the following.ebextensions
文件夹中,创建一个02_installEPELPackages.config
文件并添加以下内容packages:
yum:
chromium: []
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.