【发布时间】:2019-11-08 14:08:35
【问题描述】:
我想在 Elastic Beanstalk 上安装软件包,使用 Yarn 作为 NPM 的替代品。我尝试了在网上找到的各种解决方案,但它们似乎都已经过时并且不再有效。这就是我现在所拥有的,如this gist 中所述。
files:
'/opt/elasticbeanstalk/hooks/appdeploy/pre/49yarn.sh' :
mode: '000755'
owner: root
group: root
content: |
#!/usr/bin/env bash
set -euxo pipefail
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
if node -v; then
echo 'Node already installed.'
else
echo 'Installing node...'
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
yum -y install nodejs
fi
if yarn -v; then
echo 'Yarn already installed.'
else
echo 'Installing yarn...'
wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
yum -y install yarn
fi
'/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh' :
mode: '000755'
owner: root
group: root
content: |
#!/usr/bin/env bash
set -euxo pipefail
yarn install --ignore-engines
【问题讨论】:
标签: node.js amazon-elastic-beanstalk yarnpkg