Currently you can't install yarn using yum so there doesn't seem to be an easy way to create a config that installs it before asset pre-compilation.


You can customize packages that are installed and commands that are run on deploy with .ebextensions

For yarn, I created a file with the following commands which install a recent node version and yarn:

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

    # 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

More Documentation: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html

| improve this answer | |
  • 1
    thanks for that script. I've just fixed a missing single quote at the end of test line – fagiani Aug 19 '18 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.