Leo
Leo

Reputation: 57

error deploying rails app aws elastic beanstalk

I'm using rails 5.00 i keep getting this error when trying to deploy to aws

[Instance: i-04fd37ed6913c4a8a] Command failed on instance. Return code: 5 Output: (TRUNCATED)...ng uglifier 3.0.2 Installing unf 0.1.4 Installing turbolinks 5.0.1 Installing activesupport 5.0.0.1 An error occurred while installing nokogiri (1.6.8), and Bundler cannot continue. Make sure that gem install nokogiri -v '1.6.8' succeeds before bundling. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

Upvotes: 0

Views: 864

Answers (2)

ralinc
ralinc

Reputation: 196

You have two options to resolve your issue:

1) Add patch to .ebextensions/packages.config like this:

packages:
  yum:
    patch: []

This would make the yum package manager install it before attempting to bundle install.

2) Add a command config to .ebextensions/nokogiri_command.config like this:

commands:
  test:
    command: "bundle config build.nokogiri --use-system-libraries"

Either of these two options has worked for me. Don't forget to commit before pushing to AWS.

Upvotes: 0

Pranesha Bunsee
Pranesha Bunsee

Reputation: 36

I ran into the same error "Make sure that gem install nokogiri -v '1.6.8' succeeds before bundling."

It was due to me not selecting the correct deployment version for ruby. Initially when creating the environment I had left the ruby platform at default which happened to be version 2.3 (Passenger). Got the above error.

I terminated the environment and re-created it but chose ruby 2.2 (Puma) which is what I am using in my development environment. The AWS environment was created without any errors.

Although the above corrective action fixed the problem, it does not explain why creating a ruby 2.3 (Passenger) environment failed especially since I did a sort of "canned" build - the environment creation was via AWS console using "sample application" in the config. I did not attempt to create it via eb command line or use any of my elasticbeanstalk scripts or deploy my own app.

Upvotes: 0

Related Questions