Mat*_*tel 5 amazon-web-services node.js npm amazon-elastic-beanstalk
我有一个使用 gulp 构建生产文件的 PHP 应用程序,我使用 elasticbeanstalk 将我的应用程序部署到 AWS EC2 实例,我想安装 node 和 npm 以在部署期间运行 gulp,我当前的配置是:
.ebextensions 文件夹中的 01-installPackages.config
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
02installNode:
command:
# run this command from /tmp directory
cwd: /tmp
# don't run the command if node is already installed (file /usr/bin/node exists)
test: '[ ! -f /usr/bin/node ] && echo "node not installed"'
# install from epel repository
# flag -y for no-interaction installation
command: 'sudo yum install -y nodejs --enablerepo=epel'
Run Code Online (Sandbox Code Playgroud)
节点命令失败,但如果我 ssh 进入并运行该命令节点已安装
知道我的配置有什么问题吗?
谢谢!
您应该能够为此使用环境配置选项,而不是自己编写 bash 文件。您可以使用软件包密钥下载并安装预打包的应用程序和组件。
这将允许你做这样的事情:
packages:
yum:
nodejs: []
npm: []
Run Code Online (Sandbox Code Playgroud)
并且您需要的软件包将被安装。
注意:Amazon Linux 2 中已弃用此功能。