1

I faced some issues with bundle install.

When we run 'bundle install' , One of the dependency gem in Gemfile.lock is get auto upgraded. As per theory, "bundle install" will look the Gemfile.lock for version and won't resolve the version and will install the same versions. It will resolve only when there is no Gemfile.lock or when we give "bundle update".

In our server, we having Gemfile.lock but "bundle install" is updated the particular gem mentioned gemfile.lock(it's a dependency gem , so we not specified in gemfile), It should not happen like this, because already one version present in lock file, even though that version is get auto updated, Due to this upgrade some major functionality is broken in the site.

For your references: bundler version - 1.17.2 ruby version - 2.5.3 gem version - 2.7.6 rails version - 5.2.3 that dependency gem name is "nokogiri", This gem locked as 1.11.7, But it's updated to "1.12.1" when i give "bundle install"

Any idea to prevent this issue in future?

7
  • It's is one of dependency gem, It's there in Gemfile.lock file alone, we didn't mention it in gemfile, When we did bundle install a month ago at the time its present as 1.11.7, Again we did bundle install 2 days back, That time it's resolved into 1.12.1.
    – Bala
    Aug 17, 2021 at 16:33
  • yea got it the point you are stated here, But my question is in my last "bundle install" nokogiri upgraded, In future there is possibility for upgrading the same gem or any other gems. I mean it may be nokogiri gem anyother gem. From my point of view it's not good to mention these gems with exact version in gemfile when the similar kind of issues are happen. If the auto upgrade is happen without our knowledge mean how we can overcome this.
    – Bala
    Aug 17, 2021 at 16:45
  • Is this issue occur due to bundler or what, because have read like "bundle install" won't auto update the gems it will install dependency as mentioned in lock file, because a discussion is present related with this issue almost 6 years back. FYR: github.com/rubygems/bundler/issues/3175
    – Bala
    Aug 17, 2021 at 16:46
  • You will need to provide more details. What gems did you add? Aug 17, 2021 at 16:48
  • Sure, currently unable to view the exact things happend on the gemfile during this deployment, will update you shortly.
    – Bala
    Aug 17, 2021 at 16:52

1 Answer 1

1

First of all it'll be great if you shared the Gemfile.lock error so as to know what i particular might be causing that upgrade. But from afar I think as you said this gem is a dependency gem and it is not stated in your gemfile. It could be that another gem also depends on this gem and per that requirement it triggers an upgrade even before your supposed gem line is run which may be leading to the error. Read the error thoroughly and you can identify the gem(s) causing this.

After your update I have read around on this. Exactly so as stated earlier on, one of these gems could be the reason why your particular gem gets updated with every bundler install. Unfortunately there is no true turn around to solving this but bundler does give a way around. You can use the --frozen option with bundler which freezes your gemfile.lock to the current versions for each gem and does not update any gem but only installs new gems that you have. Unfortunately this has been deprecated and can only be done be done from /.bundle/config. This can be done from the command line in the root of your project. run bundle config frozen true to freeze bundler from updating your gems in gemfile.lock You may have to grant write permissions to your user to be able to edit the bundle configurations. I found this article as well from bigbinary.com

4
  • sure will provide few details from lock file, we didn't get any error during bundle install. one of the gem(nokogiri) is upgraded to latest version, due to this some functionality is not working. we found this issue later like it's due to upgraded nokogiri gem from 1.11.7 to 1.12.1, then we reverted back this gem back to the older version..
    – Bala
    Aug 17, 2021 at 16:55
  • these are gems which related to nokogiri. nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) nokogiri (1.11.7-x64-mingw32) azure-core (0.1.15) nokogiri (~> 1.6) azure-storage (0.15.0.preview) nokogiri (~> 1.6, >= 1.6.8) azure-storage-blob (1.1.0) nokogiri (~> 1.6, >= 1.6.8) azure-storage-common (1.1.0) nokogiri (~> 1.6, >= 1.6.8) loofah (2.12.0) nokogiri (>= 1.5.9) rails-dom-testing (2.0.3) nokogiri (>= 1.6) viewpoint (1.1.1) nokogiri
    – Bala
    Aug 17, 2021 at 17:05
  • Thanks @larry danso, Will try that "bundle config frozen true" option then update you the status.
    – Bala
    Aug 20, 2021 at 4:20
  • It's working fine, thank you. Additional references about this issue. stackoverflow.com/questions/68817050/using-bundle-frozen yehudakatz.com/2011/05/30/…
    – Bala
    Aug 23, 2021 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.