[英]React-snap faild in postbulid when uploading to AWS Amplify
I`ve pushed my react project to AWS amplify with git.我已经使用 git 将我的反应项目推送到AWS 放大。 I installed the react-snap package for SEO reasons.出于 SEO 的原因,我安装了react-snap package。 When inspecting the Amplify Console , it shows that the provision step succeeded, but the building step failed .检查Amplify Console时,显示配置步骤成功,但构建步骤失败。 The error log shows this:错误日志显示:
Some older post on github describe the same problem that I have: https://github.com/thinkJin6/BokuNews/issues/64 github 上的一些较早的帖子描述了我遇到的相同问题: https://github.com/thinkJin6/BokuNews/issues/64
I have tried out several things like adding and configuring amplify.yml file and configuring the package.json as described here:我已经尝试了一些方法,例如添加和配置 amplify.yml 文件以及配置 package.json,如下所述: . . https://github.com/puppeteer/puppeteer/issues/765 https://github.com/puppeteer/puppeteer/issues/765
Finally I tried out some stuff from this link: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-aws-ec2-instance-running-amazon-linux最后我从这个链接尝试了一些东西: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-aws-ec2-instance-running-amazon-linux
I enable amazon-linux-extras like this, sudo amazon-linux-extras install epel -y , and installed install Chromium like this, sudo yum install -y chromium .I used AWS CloudShell , but the error log message keeps the same.我像这样启用 amazon-linux-extras , sudo amazon-linux-extras install epel -y ,并像这样安装 install Chromium , sudo yum install -y chromium 。我使用了AWS CloudShell ,但错误日志消息保持不变。
I had the same problem recently and with help of a colleague, the solution was found here: LINK我最近遇到了同样的问题,在同事的帮助下,在这里找到了解决方案: LINK
I added the following to my package.json我将以下内容添加到我的 package.json
"reactSnap": {
"puppeteerArgs": [
"--no-sandbox",
"--disable-setuid-sandbox"
],
"puppeteerExecutablePath": "/opt/google/chrome/google-chrome"
}
Then I updated amplify.yml in was amplify build settings like so然后我更新了 amplify.yml,就像这样放大构建设置
version: 1
frontend:
phases:
preBuild:
commands:
- '# This installs Chrome on any RHEL/CentOS/Amazon Linux variant.'
- curl https://intoli.com/install-google-chrome.sh | bash
- npm i
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.