I just added this new Gem to my Gemfile: gem 'pg_query'
and when I run bundle install
locally, everything works just fine. However, when I try to deploy to elasticbean stalk, I get this error that I wasn't getting before:
2021/11/18 00:33:20.171799 [ERROR] An error occurred during execution of command [app-deploy] - [stage ruby application]. Stop running the command. Error: install dependencies in Gemfile failed with error Command /bin/sh -c bundle install failed with error exit status 1. Stderr:Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your lockfile was created by an old Bundler that left some things out.
You can fix this by adding the missing gems to your Gemfile, running bundle install, and then removing the gems from your Gemfile.
The missing gems are:
* google-protobuf depended upon by pg_query
Here's my Gemfile.lock
: https://pastebin.com/X9VqfFkK
Here's my Gemfile
: https://pastebin.com/e9aBu9EQ
Any ideas what might be going on? I feel like this is related to elastic beanstalk since I've had trouble with installing gems on there in the past.
CodePudding user response:
It looks like the requested gem google-protobuf is only included for macOS/Darwin operating systems. To have it included in Gemfile.lock for Linux systems, you'll need to run the following command locally:
bundle lock --add-platform x86_64-linux
(I'm presuming Elastic Beanstalk uses Linux - adjust the platform as needed)
My understanding is this applies for gems that have versions compiled for particular platforms. Bundler doesn't include all known platforms by default - so if your development and deployment environments are different, then adding the appropriate platforms ensures further bundling covers all relevant situations.
CodePudding user response:
For anyone in the future who may run into this, thanks to @pat for pointing this out, it looks like the solution was to manually change this line in my Gemfile.lock
from:
google-protobuf (3.19.1-x86_64-darwin)
to:
google-protobuf (3.19.1)
After that, the deploy worked and bundle install
also worked locally! The platform on my elastic beanstalk is running Linux, so I think that was one of the reasons for the initial error.