如何在弹性豆茎上安装纱线?

cha*_*ory 7 ruby-on-rails amazon-web-services elastic-beanstalk

目前您无法使用 yum 安装 yarn,因此似乎没有一种简单的方法来创建在资产预编译之前安装它的配置。

小智 11

您可以自定义已安装的包和在部署时运行的命令 .ebextensions

对于纱线,我使用以下命令创建了一个文件,这些命令安装了最新的节点版本和纱线:

# .ebextensions/yarn.config
commands:
  01_install_node:
    command: |
      sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
      sudo yum -y install nodejs

  02_install_yarn:
    # don't run the command if yarn is already installed (file /usr/bin/yarn exists)
    test: '[ ! -f /usr/bin/yarn ] && echo "Yarn not found, installing..."'
    command: |
      sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
      sudo yum -y install yarn
Run Code Online (Sandbox Code Playgroud)

更多文档:https : //docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html