Home > front end >  Getting error when updating puma gem using bundler
Getting error when updating puma gem using bundler

Time:06-29

I am trying to update puma gem using bundle in my application through this command

bundle update puma

But it is showing this error

Your bundle is locked to elasticsearch-model (7.1.1) from https://github.com/elastic/elasticsearch-rails.git (at 6.x@606f348), but that version can no longer be found in that source. That means the author of elasticsearch-model (7.1.1) has removed it.
You'll need to update your bundle to a version other than elasticsearch-model (7.1.1) that hasn't been removed in order to install.

I am not sure what it means. When I search inside my gemfile for " elasticsearch " I am getting only one match which is

gem "elasticsearch-persistence", git: "https://github.com/elastic/elasticsearch-rails.git", branch: "6.x"

Similarly when I search for " elasticsearch " inside Gemfile.lock here are the matches

GIT
  remote: https://github.com/elastic/elasticsearch-rails.git
  revision: 606f3482e298fab0afc5a083468f23ec7464b0d3
  branch: 6.x
  specs:
    elasticsearch-persistence (6.1.0)
      activemodel (> 4)
      activesupport (> 4)
      elasticsearch (~> 6)
      elasticsearch-model (>= 5)
      hashie

    elasticsearch (6.8.1)
      elasticsearch-api (= 6.8.1)
      elasticsearch-transport (= 6.8.1)
    elasticsearch-api (6.8.1)
      multi_json
    elasticsearch-model (7.1.1)
      activesupport (> 3)
      elasticsearch (> 1)
      hashie
    elasticsearch-transport (6.8.1)
  elasticsearch-persistence!

Any idea how can I resolve this error? Thanks

CodePudding user response:

The elasticsearch-model gem is a dependency of the elasticsearch-persistence gem. Because your Gemfile only has an entry for the elasticsearch-persistence bundler will try to load the latest version of the elasticsearch-model gem it can find.

Furthermore, you do not load the elasticsearch-persistence from Rubygems but directly from their GitHub repository. But bundler will load the elasticsearch-model dependency from Rubygems.

I agree that the error message is very confusing. And I guess that the latest version of elasticsearch-model is simply not compatible with the older version of elasticsearch-persistence from GitHub.

I suggest just changing the elasticsearch-persistence line from your Gemfile to the following to ensure that both gems are loaded in the same version from the same source (like suggested in the README):

gem 'elasticsearch-model', github: 'elastic/elasticsearch-rails', branch: '6.x'
gem 'elasticsearch-persistence', github: 'elastic/elasticsearch-rails', branch: '6.x'

And then try running bundle install again.

  • Related