我按照说明做了这个 https://yarnpkg.com/lang/en/docs/install/
commands: 01_install_yarn: command: "sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash - && sudo yum install yarn -y"
EB默认支持npm所以我建议安装 的 纱 强> 通过部署脚本 .ebextensions 。那应该做。
通过这种方式,我可以通过Elastic Beanstalks Dashboard控制节点版本。
谢谢你的回答!没有它,就不可能找到这个解决方案:D
"/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh": mode: "000755" owner: root group: users content: | #!/usr/bin/env bash # # Prevent installing or rebuilding like Elastic Beanstalk tries to do by # default. # # Note that this *overwrites* Elastic Beanstalk's default 50npm.sh script # (https://gist.github.com/wearhere/de51bb799f5099cec0ed28b9d0eb3663). "/opt/elasticbeanstalk/hooks/configdeploy/pre/50npm.sh": mode: "000755" owner: root group: users content: | #!/usr/bin/env bash # # Prevent installing or rebuilding like Elastic Beanstalk tries to do by # default. # # Note that this *overwrites* Elastic Beanstalk's default 50npm.sh script. # But their default script actually doesn't work at all, since the app # staging dir, where they try to run `npm install`, doesn't exist during # config deploys, so ebnode.py just aborts: # https://gist.github.com/wearhere/de51bb799f5099cec0ed28b9d0eb3663#file-ebnode-py-L140 "/opt/elasticbeanstalk/hooks/appdeploy/pre/49yarn.sh" : mode: "000775" owner: root group: users content: | tmp="$(mktemp || bail)"; app="$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)"; version="$(/opt/elasticbeanstalk/bin/get-config optionsettings -n aws:elasticbeanstalk:container:nodejs -o NodeVersion)"; echo $version major="$(cut -d'.' -f1 <<<${version})" yum -y install python26 python26-libs wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo; wget "https://rpm.nodesource.com/pub_${major}.x/el/7/x86_64/nodejs-${version}-1nodesource.x86_64.rpm" -O "${tmp}"; rpm -i --nosignature --force "${tmp}"; rm -f "${tmp}"; yum -y install yarn; cd "${app}"; yarn --production;