Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Could not find concurrent-ruby-1.0.5 in any of the sources (Bundler::GemNotFound)

I've Googled this quite a bit, and haven't found anything useful to my situation.

$ docker-compose up abc

produces the following in the logs:

/usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:92:in `block in materialize': Could not find concurrent-ruby-1.0.5 in any of the sources (Bundler::GemNotFound)
   from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:85:in `map!'
   from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:85:in `materialize'
   from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:132:in `specs'
   from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:177:in `specs_for'
   from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:166:in `requested_specs'
   from /usr/lib/ruby/vendor_ruby/bundler/environment.rb:18:in `requested_specs'
   from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:13:in `setup'
   from /usr/lib/ruby/vendor_ruby/bundler.rb:121:in `setup'
   from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:17:in `<top (required)>'
   from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
   from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

The relevant bit from my docker-compose.yml file: command: bundle exec rails server

concurrent-ruby is most definitely installed, exactly where it needs to be. I've run bundle install inside Docker so many times, and I've tried adding gem install concurrent-ruby -v 1.0.5 to my docker-compose command, and it installs just fine, and then still complains that it can't find the gem. I tried adding bundle install directly to my docker-compose command, and that fails because of some known issue involving docker-compose and git (I'm using two internal gems). [ EDIT: https://github.com/docker/compose/issues/2856#issuecomment-236625662 ]

Everything worked fine until I upgraded some Ruby gems, but I'm not sure why or how to fix it.

like image 958
user19230 Avatar asked Aug 13 '18 14:08

user19230


3 Answers

I had an issue similar to this outside of Docker.

I deleted the Gemfile.lock and ran bundle.

Issue went away.

Your mileage may vary.

like image 141
dmmfll Avatar answered Nov 11 '22 02:11

dmmfll


I had this same error with docker-compose. Apparently, it was installing the gem, after running docker-compose run backend bundle install the Gemfile.lock file was updated correctly. Still, it would continue displaying this error either for this gem or others.

Turns out that in some cases just running bundle install with docker is not enough. As specified in the documentation here: https://docs.docker.com/compose/rails/ sometimes after running bundle install you need to rebuild the images. This fixed my problem:

docker-compose run backend bundle install
docker-compose build
like image 3
Jose Avatar answered Nov 11 '22 00:11

Jose


tl;dr: Set GEM_HOME = BUNDLE_PATH

Since you're using docker, I also assume you are maybe changing the value of BUNDLE_PATH so you can cache the gems? If so, you'll also want to set the GEM_HOME variable to this value.

I can't exactly explain why. My theory is that.. something.. is incorrectly using the value of GEM_HOME when it should be using BUNDLE_PATH, and thus the gems you installed from your rails project's Gemfile are not there.

like image 2
Kabir Sarin Avatar answered Nov 11 '22 01:11

Kabir Sarin