![](/img/trans.png)
[英]how to change npm install command in ElasticBeanstalk (Node)?
[英]AWS Elasticbeanstalk install node and npm in PHP instance type
我有一個使用 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'
節點命令失敗,但如果我 ssh 進入並運行該命令節點已安裝
知道我的配置有什么問題嗎?
謝謝!
您應該能夠為此使用環境配置選項,而不是自己編寫 bash 文件。 您可以使用包鍵下載和安裝預打包的應用程序和組件。
這將允許您執行以下操作:
packages:
yum:
nodejs: []
npm: []
您需要的軟件包將被安裝。
注意:這在 Amazon Linux 2 中已被棄用。
目前對此的回答如下:
commands:
01enable_epel:
command: sudo amazon-linux-extras install epel
02npm_install:
command: sudo yum -y --enablerepo=epel install nodejs npm
使用AWS 文檔中記錄的 extras 庫
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.