No package nodejs available. Error: Nothing to do. Rails App On Elastic Beanstalk

No package nodejs available. Error: Nothing to do. Rails App On Elastic Beanstalk

我已经在 Elastic Beanstalk 上使用我的 Rails 6 应用程序超过 6 个月了,没有任何问题。昨天在部署了一些更改后突然开始失败,因为它无法安装 NodeJs,这与我之前部署的更改无关。

我有 01_download_nodejs02_install_nodejs 用于 eb 配置的命令,自从我大约 6 个月前第一次设置该应用程序以来,它们一直没有改变。

cfn-init.log 文件中显示如下:

2021-10-02 08:46:19,017 [INFO] Command 01_download_nodejs succeeded
2021-10-02 08:46:23,515 [ERROR] Command 02_install_nodejs (yum -y install nodejs) failed
2021-10-02 08:46:23,516 [ERROR] Error encountered during build of prebuild_2_sst_app: 
Command 02_install_nodejs failed
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 573, in run_config
  CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 273, in build
  self._config.commands)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
  raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 02_install_nodejs failed
2021-10-02 08:46:23,516 [ERROR] -----------------------BUILD FAILED!------------------------
2021-10-02 08:46:23,516 [ERROR] Unhandled exception during build: Command 
02_install_nodejs failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 176, in <module>
  worklog.build(metadata, configSets)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 135, in build
  Contractor(metadata).build(configSets, self)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 561, in build
  self.run_config(config, worklog)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 573, in run_config
  CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 273, in build
  self._config.commands)
File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
  raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 02_install_nodejs failed

cfn-init-cmd.log 文件中显示如下:

2021-10-02 08:46:18,976 P22197 [INFO] Command 01_download_nodejs
2021-10-02 08:46:19,017 P22197 [INFO] Completed successfully.
2021-10-02 08:46:19,017 P22197 [INFO] 
============================================================
2021-10-02 08:46:19,017 P22197 [INFO] Command 02_install_nodejs
2021-10-02 08:46:23,514 P22197 [INFO] -----------------------Command Output-----------------------
2021-10-02 08:46:23,515 P22197 [INFO]   Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
2021-10-02 08:46:23,515 P22197 [INFO]   No package nodejs available.
2021-10-02 08:46:23,515 P22197 [INFO]   Error: Nothing to do
2021-10-02 08:46:23,515 P22197 [INFO] ------------------------------------------------------------
2021-10-02 08:46:23,515 P22197 [ERROR] Exited with error code 1

01_download_nodejs:

command: "curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo -E bash -"

02_install_nodejs:

command: "yum -y install nodejs"

Elastic Beanstalk 平台版本:3.3.5

您遇到的问题可能是由于 SSL 证书过期所致,如下所述:https://aws.amazon.com/premiumsupport/knowledge-center/ec2-expired-certificate/

您可以使用安装最新证书的 .ebextensions 中的文件解决此问题。例如,对于亚马逊 Linux 1:

commands:
  00_ssl_certs:
    command: yum -y install https://cdn.amazonlinux.com/patch/ca-certificates-update-2021-09-30/ca-certificates-2018.2.22-65.1.24.amzn1.noarch.rpm