Ask A Question

Notifications

You’re not receiving notifications from this thread.

Deploying Tailwind to AWS Elastic Beanstalk

Gerard Donnelly asked in General

I was wondering if anyone has experience of deploying A Rails 6 app with Tailwind to AWS Elasticbeanstalk.

I have tried a dozen times now however the build keeps failing.

I am getting the following error in code pipeline:

Action execution failed Deployment completed, but with errors: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version. Failed to deploy application. Unsuccessful command execution on instance id(s) 'i-0ef9ce5572262bb0d'. Aborting the operation. [Instance: i-0ef9ce5572262bb0d] Command failed on instance. Return code: 1 Output: (TRUNCATED)...cy: nodejs for package: yarn-1.22.15-1.noarch --> Finished Dependency Resolution Error: Package: yarn-1.22.15-1.noarch (yarn) Requires: nodejs You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest. command 01_install_yarn in .ebextensions/01_rails_deploy.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

The start of file 01_rails_deploy.config in my .ebextensions directory looks like this:

commands:
00_remove_old_node_if_present:
command: "/bin/rm -rf /var/cache/yum && /usr/bin/yum remove -y nodejs && /bin/rm /etc/yum.repos.d/nodesource* && /usr/bin/yum clean all"
ignoreErrors: true
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_12.x | sudo bash - && sudo yum install yarn -y"
02_install_nodejs:
command: "yum -y install nodejs"
03_mkdir_webapp_dir:
command: "mkdir /home/webapp"
ignoreErrors: true
04_chown_webapp_dir:
command: "chown webapp:webapp /home/webapp"
ignoreErrors: true
05_chmod_webapp_dir:
command: "chmod 0744 /home/webapp"
ignoreErrors: true

Any help would be super appreciated.

Reply
  1. You should install node LTS instead of 12.x, that way you'll always be on the stable version.
  2. The error says you're trying to install Yarn without nodejs. You should install nodejs either before or at the same time as you install yarn.

Something like this is more what you want I imagine:

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_12.x | sudo bash -"
02_install_nodejs:
command: "yum -y install nodejs yarn"
Reply

Thanks for coming back so quickly Chris.

Unfortunately it still didn't work. Got the error:

Aborting the operation. [Instance: i-070afc6bfda831a60] Command failed on instance. Return code: 1 Output: Loaded plugins: priorities, update-motd, upgrade-helper No package nodejs available. Error: Nothing to do. command 02_install_node in .ebextensions/01_rails_deploy.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

I also tried writing it like:

commands:
00_remove_old_node_if_present:
command: "/bin/rm -rf /var/cache/yum && /usr/bin/yum remove -y nodejs && /bin/rm /etc/yum.repos.d/nodesource* && /usr/bin/yum clean all"
ignoreErrors: true
01_add_node:
command: "curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -"
02_install_node:
command: "yum install nodejs"
03_install_yarn:
command: "sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo"
04_install_nodejs:
command: "yum -y install yarn"

Stumped with it.

Here is what the activity log shows. It seems to find Node JS download but then can't find it to install: https://ibb.co/gFPq9Qk

I'd be grateful of any other advice.

Reply

No package nodejs available

Sounds like your nodejs repository hasn't been loaded / updated so it can find the nodejs package.

Reply

Thanks for the feedback Chris.

I finally managed to get it sorted by following this post of the same issue: https://istvan.co/how-to-install-node-yarn-on-elastic-beanstalk/

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.