I'm trying to install canvas lms , but I have faced with the following issue. Any help. enter image description hereplease
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (>= 2.2.17, <= 2.2.24)
Current Bundler version:
bundler (2.2.28)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with gem install bundler:2.2.24 and rerun bundler using bundle _2.2.24_ update
I tried updating bundle but no success yet.
Try the following:
gem install bundler -v 2.2.24
bundle _2.2.24_ install
I'm having trouble creating a new Rails app. I'm using a fresh WSL2 + Ubuntu 18.04 install.
Long story short, I followed the Rails installation procedure from https://gorails.com/setup/windows/10 but when installing bundle using gem install bundler, I end up with 2 bundler versions (2.1.2 and 2.1.4).
If I stick with 2.1.2 webpacker throws an error, so I definitely need to install the newest version. The problem is, when I install 2.1.4 the default version remains 2.1.2, so then I go to cd /.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/specifications/default and remove bundler-2.1.2.gemspec, and then I do a gem install bundler --default to get only v2.1.4 as default:
gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4)
But here is the problem; if I run bundler -v I get:
bundler -v
Bundler version 2.1.2
But the real problem is that, when running rails new, it clearly tries to use 2.1.2 which inevitably fails.
How can I solve this?
Thank you
Try gem uninstall bundler --version 2.1.2.
From the app directory run these commands:
gem install bundler
bundle update --bundler
bundle install
This rebuilds the Gemfile.lock with the correct Bundler version.
EDIT: You can create the directory first with rails new my_rails_app, then do cd .. ; rails new my_rails_app after running the above commands.
I have rails project working on Ubuntu.
Now I installed WSL on another machine and cloned the very same project.
Now when I try to install bundler with
gem install bundler
it installed bundler 2.0.2 and on bundle install it gives error:
Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails (~> 5.0.0)'
Now I looked at the gemfile.lock it was bundled with 1.16.4, I installed it with
gem install bundler -v '1.16.4'
Now I do a simple bundle install, then it uses 2.0.2, so I have to do
bundle _1.16.4_ install
It completed successfully, but now when I am trying to do rails db:create, it says
The git source https://github.com/activerecord-hackery/ransack.git is not yet checked out. Please run bundle install before trying to start your application
What's wrong here?
Uninstall bundler 2.0.2:
gem uninstall bundler -v 2.0.2
If you still have problem, you can use:
bundle exec rails db:create
You can update to using bundler 2.x if possible with:
bundle update --bundler
This will change the BUNDLED_WITH version in Gemfile.lock.
see: https://bundler.io/guides/bundler_2_upgrade.html
You could also set the default bundler version:
bundler config default 1.16.4
gem list bundler
However I have found this to be a bit error prone.
Try to remove all your gems (go to the gems folder of your ruby, remove the specifications folder and the gems folder),
gem list should be more or less empty
gem install bundler
And try to bundle install again from scratch.
I tried to change default bundle version but it getting updated with 2 default version. How can I modify to single default?
$ gem list bundler
*** LOCAL GEMS ***
bundler (2.0.1, default: 1.16.6, default: 1.16.2)
If I do gem uninstall not removing defaults,
$ gem uninstall bundler
Successfully uninstalled bundler-2.0.1
$ gem list bundle
*** LOCAL GEMS ***
bundler (default: 1.16.6, default: 1.16.2)
How can I set (like the below) default as single version?
bundler (2.0.1, default: 1.16.6)
For those who use rbenv, let say by accidentally you have two default versions
$ gem list | grep bundler
bundler (default: 2.1.4, default: 1.17.2)
Check your gem installation path
$ gem environment
RubyGems Environment:
.
.
- INSTALLATION DIRECTORY: /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
.
Go to the specifications/default directory and look for bundlers gemspec
$ cd /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/specifications/default
$ ls -lah
total 200K
drwxr-xr-x 2 yohanes yohanes 4,0K Jun 1 10:05 .
drwxr-xr-x 3 yohanes yohanes 20K Jun 1 10:05 ..
.
.
-rw-r--r-- 1 yohanes yohanes 16K Jun 1 10:05 bundler-1.17.2.gemspec
-rw-r--r-- 1 yohanes yohanes 15K Jun 1 09:31 bundler-2.1.4.gemspec
.
.
Remove the version that you need to remove
$ rm bundler-2.1.4.gemspec
Check again
$ gem list | grep bundler
bundler (default: 1.17.2)
$ gem list bundler
*** LOCAL GEMS ***
bundler (default: 1.17.2)
but, if you check bundle version, you still get the deleted version as default
$ bundler -v
Bundler version 2.1.4
So we have to overrides it by reinstalling the required bundler version again
$ gem install bundler --version '1.17.2'
Successfully installed bundler-1.17.2
Parsing documentation for bundler-1.17.2
Done installing documentation for bundler after 1 seconds
1 gem installed
Then, if you check again it will show you the desired version
$ bundle -v
Bundler version 1.17.2
I had the same problem but with a newer version
$ gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4, default: 2.1.2)
But after following indications on this post Two default versions of rake installed - how to delete one allowed me to deleted one.
You have to delete the .gemspec file corresponding to the default gem you want to delete.
So first, locate where those files are.
# I'm running RVM to manage my Ruby versions
~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/
-rw-r--r-- 1 myuser staff 10731 Dec 26 17:22 bundler-2.1.2.gemspec
-rw-r--r-- 1 myuser staff 15134 Jan 7 17:30 bundler-2.1.4.gemspec
Delete the one you don't need.
$ rm ~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.2.gemspec
Then install (or reinstall) the gem you want to set as default.
$ gem install bundler:2.1.4 --default
Successfully installed bundler-2.1.4 as a default gem
Finally you'll have installed only the version you wanted.
$ gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4)
gem update --system
This command work for me
After run try this gem list bundler
The rbenv path to the offending default .gemspec should be like below.
/Users/yourusername/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.2.gemspec
I observed that sometime default gems are not present in the INSTALLATION DIRECTORY path provided in the output of gem environment command.
I observed this problem in Alpine OS where Ruby v2.7.0 is installed.
In such cases you can use gem list -d <GEM_NAME> -v <VERSION> command to get the location where default gem is installed.
/ # gem list -d rexml -v 3.2.3
*** LOCAL GEMS ***
rexml (3.2.3)
Author: Kouhei Sutou
Homepage: https://github.com/ruby/rexml
License: BSD-2-Clause
Installed at (default): /usr/lib/ruby/gems/2.7.0
An XML toolkit for Ruby
To remove default version you can use /usr/lib/ruby/gems/2.7.0 shown in above output. Delete command will be:
rm -rf <INSTALLED_AT_PATH>/specifications/default/<GEM_NAME>-<VERSION>.gemspec
For example:
rm -rf /usr/lib/ruby/gems/2.7.0/specifications/default/rexml-3.2.3.gemspec
With some bundler versions: you just get:
gem list bundler
# bundler (2.1.4, default: 1.17.3)
you install new version of bundler, set it to default and you get multiple default bundler versions
gem install --default bundler -v2.3.8
# bundler (default: 2.3.8, 2.1.4, default: 1.17.3)
and than you can reinstall old default version without --default parameter so it would be reinstalled as non-default and than you can uninstall it.
gem install bundler -v1.17.3
# bundler (default: 2.3.8, 2.1.4, 1.17.3)
and uninstall old default one
gem uninstall bundler -v1.17.3
# bundler (default: 2.3.8, 2.1.4)
Came late to the party but perhaps my findings may help somebody:
After Ruby 2.6 bundler became a default gem this means that for each ruby version there's a default bundler, and the bundler gem comes with an executable bundle command.
You can't remove this gem and the only way to update the default gems is to update the RubyGems system using gem update --system [<version>]
I Had a lot of problems removing files in install paths to force the default gem, I wouldn't recommend but YMMV. In order to have a ruby 2.6.x with a 2.x default and working bundler, I had to start from a clean ruby installation and update the Rubygems to the point it had the bundler version that the project required.
As #theist points out, after Ruby 2.6 bundler became a default gem. So depending on your version of Ruby, you will have a different version of bundler included. You can see the list here.
But what has not been explained in the answers so far is that you can control which version of bundler is used by editing your Gemfile.lock and specifying the version you want to use on the very last line of the file, where it says:
BUNDLED WITH
2.2.33
This feels completely backwards since Gemfile.lock is supposed to be generated automatically by bundler, but that is the state of things at this point.
So, let's explain it all with an example. Let's say I am using Ruby 3.0.3. This version of Ruby comes with bundler 2.2.32. But my hosting company, Heroku, is using bundler 2.2.33. Since I want my dev environment to use the same bundler version as my production environment, I want to use 2.2.33.
So the first thing to do is gem install bundler -v "2.2.33". Then change the very bottom line of Gemfile.lock to say that it was bundled with 2.2.33 like:
BUNDLED WITH
2.2.33
Now when you run bundle install it will use bundler 2.2.33.
You can find the default one at /usr/local/bin/, so if you delete that one and have ruby installed with homebrew for instance, it will dafault to the one that homebrew has.
After deleting it you should see something like:
open . /usr/local/bin/
bundler -v
Bundler version 2.3.25
which bundler
/opt/homebrew/opt/ruby/bin/bundler
If and only if you are using ruby with homebrew, make sure you have it exported to your path: export PATH=/opt/homebrew/opt/ruby/bin:$PATH
TLDR: uninstall ruby & then reinstall it.
Details:
For others using rbenv who have exhausted other ideas, the following worked for me:
exit your project directory (e.g. cd /tmp)
uninstall ruby (e.g. rbenv uninstall 2.6.6)
reinstall ruby (e.g. rbenv install 2.6.6)
return to your project directory (cd -)
install the RubyGems you desire (e.g. gem install bundler:2.1.4)
In your project directory you will see something like this:
-bash> gem list | grep bundle
bundler (2.1.4, default: 1.17.2)
Outside your project directory (e.g. cd /tmp) you will see something like this:
-bash> gem list | grep bundle
bundler (default: 1.17.2)
I've joined a project which is using bundler version 1.17.1 . Currently my system is using bundler 2.0.2 . Is there any way for me to specify a bundler version just like specifying ruby version with rbenv. Something likes:
bundler --global 1.17.1
So that, when I run the command bundler -v I will receive the result 1.71.1 rather than 2.0.2
I tried to uninstall the current bundler with gem uninstall bundler and received this message:
$ gem uninstall bundler
Select gem to uninstall:
1. bundler-1.17.1
2. bundler-1.17.3
3. bundler-2.0.2
4. All versions
>
That makes me think there is a certain way allows me to work with multiple bundler versions. Any clues just for pointing me to where I should look up would be really appreciated.
EDIT 1
I tried bundle _1.17.1_ --version and it didn't work as I expected
$ bundler -v
Bundler version 2.0.2
$ bundle _1.17.1_ --version
Bundler version 1.17.1
$ bundler -v
Bundler version 2.0.2
expected: Bundler version 1.17.1
actual: Bundler version 2.0.2
Try this:
1) gem install bundler -v 1.17.1
2) bundle _1.17.1_ install
You can specify multiple bundler versions by using underscores: RubyGems already provides this functionality. Specify the version number in underscores as the first argument on the command line.
$ bundle _1.1.3_ --version
Bundler version 1.1.3
$ bundle _1.1.0_ --version
Bundler version 1.1.0
$ bundle _1.0.22_ --version
Bundler version 1.0.22
There's an issue in rbenv with a similar question: https://github.com/rbenv/rbenv/issues/235.
Hope this helps