我正在尝试将VueJS rails 5应用程序部署到ElasticBeanstalk上,当我尝试执行时,在EB实例上遇到命令失败错误。
我尝试了一些建议,例如重新生成锁定文件,但无法克服以下错误:
Command failed on instance. Return code: 1 Output: (TRUNCATED)...lation.
error @nuxt/opencollective@0.3.0: The engine "node" is incompatible with
this module. Expected version ">=8.0.0". Got "6.17.1" error Found
incompatible module. info Visit https://yarnpkg.com/en/docs/cli/install
for documentation about this command.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn_install.sh failed.
For more detail, check /var/log/eb-activity.log using console or EB CLI.
这里发生了什么,如何使部署正常工作?
谢谢
答案 0 :(得分:0)
对此的答案是,EBS使用了6.X之类的NodeJS的超旧版本。
您需要在/.ebextensions中添加一些命令以删除旧版本并进行更新。以下是我发现的特定于升级NodeJS的代码的一部分
# .ebextensions/fix_rails_6.config
commands:
00_remove_node_6_if_present:
command: "/bin/rm -rf /var/cache/yum && /usr/bin/yum remove -y nodejs && /bin/rm /etc/yum.repos.d/nodesource* && /usr/bin/yum clean all && rm -rf /var/cache/yum"
ignoreErrors: true
01_download_nodejs:
command: "curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -"
02_install_nodejs:
command: "yum -y install nodejs"