Docker: Ruby version change causing issue with the bundler version - ruby

I am trying to update ruby version from 2.7.5 to 3.1.1 but after changing .ruby-version and running docker-compose build I am seeing following error during build
#34 2.552 >> Bundling for a production/staging environment
#34 4.943 Bundler 2.3.10 is running, but your lockfile was generated with 2.1.4. Installing Bundler 2.1.4 and restarting using that version.
#34 66.70 Fetching gem metadata from https://rubygems.org/.
#34 67.14 Fetching bundler 2.1.4
#34 68.59 Installing bundler 2.1.4
#34 70.09 Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
#34 73.84 Fetching gem metadata from https://rubygems.org/.........
#34 80.77 Fetching gem metadata from https://rubygems.org/.
#34 80.94 Resolving dependencies......
#34 81.77 async-io-1.27.7 requires ruby version ~> 2.4, which is incompatible with the
#34 81.77 current version, ruby 3.1.1p18
After searching for this error online it says the solution is to run
bundle _2.3.10_ update --bundler
I have bunch of questions. How can I run this command since I run everything in docker container? Also would this change be temporary as currently the bundler version in gemfile.lock is 2.1.4 and how can I update that so I dont see the error again if I remove containers and run project again?

Related

Why does ruby-filemagic-0.7.2 throw this message when finished installing

I am new to ruby and bundler.
I run bundle install on an app and got this result on console.
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies........
Using rake 12.3.0
Using concurrent-ruby 1.0.5
[...]
Using carrierwave 2.1.0
Fetching ruby-filemagic 0.7.2
Installing ruby-filemagic 0.7.2 with native extensions
Fetching carrierwave-magic 0.0.4
Installing carrierwave-magic 0.0.4
[...]
Bundle complete! 34 Gemfile dependencies, 101 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from ruby-filemagic:
ruby-filemagic-0.7.2 [2017-07-02]:
* Fix segfault on <tt>buffer(nil)</tt> when compiled with GCC (pull request
#24 by Yuya Tanaka)
It's not a problem for running ,I think, but just to know why does the gem throw this pull request result.
Is it important to throw this message?
Thanks.
You are using version 0.7.2. The author of that gem included a postinstall hook for the gem that prints the message:
Fix segfault on buffer(nil) when compiled with GCC (pull request #24 by Yuya Tanaka)
This is the same message seen in the gem's changelog.
Is it important? No, and most gem authors do not include postinstall messages. Why does it throw it? You can read some discussion about messages at How to add a (pre/post)_install_hook to ruby gems.
If you'd like to disable these messages you can read more at How to disable post-install messages from rubygems?.
Finally, for a more detailed review of these messages you can read more at A Guide to Ruby Gem Post-Install Messages.

Bundler could not find compatible versions for gem "bundler": In Gemfile:

I'm making GitHub blog page with Jekyll. I've failed like numerous times and just forked new one and followed README on the repository.
It's https://github.com/janczizikow/sleek/blob/master/README.md
and I tried to run inside the directory(master) but this msg keeps coming out.
I tried 'gem install bundler' 'gem cleanup' and similar solutions on the internet but still can't fix it. I get that I need another version which is lower one, then how can I remove the current one and install the version I need?
I've never used Ruby so I'm SO lost. A little advice will mean a lot.
bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (~> 1.12) x64-mingw32
Current Bundler version:
bundler (2.0.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (~> 1.12)' in any of the relevant sources:
the local ruby installation
Version 2.0.2 comes from gem install bundler, but the project uses bundler version 1.12.
To fix your issue run
gem install bundler -v 1.12
bundle _1.12_ install
To start Jekyll run jekyll serve or bundle exec jekyll serve.

Error in celluloid gem installation

Recently I have update my rails version to 4.2.3 and ruby version to ruby-2.2.3. After that when I do bundle it gives following error:
$ bundle
Fetching gem metadata from http://rubygems.org/..........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Could not find celluloid-0.16.1 in any of the sources
Could you help me?
Version 0.16.1 of the celluloid gem was yanked and is not available anymore. You will need to downgrade to 0.16.0 or upgrade to 0.17.x. Run:
bundle update celluloid

getting error while installing watir gem on ruby193

C:\Ruby193>gem install watir
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/tes
t/files/special! "chars'.gif
error while installing ruby gem.
This is due to a bug in the mini_magick gem - see Issue 145. While the issue has been fixed, a new release not yet been released.
You can try getting the unreleased version of mini_magick, though it is probably easier to just use the older version.
Manually install mini_magick (previous version), then install watir:
gem install mini_magick -v 3.5
gem install watir

How to set bundler version in heroku?

I need to specific the ruby version in my gemfile but my app in heroku is using the old bundler version 1.0.7.
If I include gem 'bundler', '1.3.2' in my gemfile it failed when I push to heroku.
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (= 1.3.2)
Current Bundler version:
bundler (1.0.7)
Your version of Bundler is older than the one requested by the Gemfile.
Perhaps you need to update Bundler by running `gem install bundler`.
I also try running heroku run "gem install bundler" and it return permission error.
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/ruby1.9.2/lib/ruby/gems/1.9.1
directory.
How can i set the Bundler version to 1.3.2 in heroku so that I can specific ruby version?
Heroku manages bundler as part of stack. I'm guessing you are on the Bamboo stack as that uses 1.0.7 whereas Cedar is using 1.3.x version.
If you're on Bamboo then you don't have any options I'm afraid, aside from upgrading to Cedar where you will get all the latest goodness.

Resources