0

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.

Mayur Shah
  • 3,344
  • 1
  • 22
  • 41
Leo
  • 57
  • 1
  • 6
  • nokogiri is such a pain sometimes. You really need to try installing it like it suggests. Turn on SSH for you EB env. Then run the gem install manually. Chances are it will blow up with an error message. Take that error message and google. You probably will need to do something like http://stackoverflow.com/questions/25963315/nokogiri-installation-failes-on-elastic-beanstalk – George Whitaker Oct 23 '16 at 11:50

2 Answers2

0

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.

Mayur Shah
  • 3,344
  • 1
  • 22
  • 41
ralinc
  • 166
  • 2
  • 5
0

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.