rails bundler version issue - ruby-on-rails

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.

Related

problem installing canvas on ubuntu,Bundler could not find compatible versions for gem "bundler"

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

Bundler version wrong?

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.

Rails: Could not find minitest-4.7.5 in any of the sources

Here is a trouble: on my remote server command gem list shows:
some gems
minitest (4.7.5)
....
bundle show minitest command shows:
/var/lib/gems/1.9.1/gems/minitest-4.7.5
bundle show rails shows the same directory
bundle -v - 1.6.2 (the latest version)
But I've an error: Could not find minitest-4.7.5 in any of the sources (Bundler::GemNotFound)
The steps I've made
Delete Gemfile.lock and bundle install again
Reinstall bundler
Ruby version 2.1.2
Bundle install output shows Using minitest (4.7.5)
On the remote server run gem update bundler and after bundle install.
I think maybe the gems you installed system-wide cause the problem.
You may try bundle package locally, and commit the gems generated in vendor/cache. Pull it on server, and try bundle install —local.
Or, you may just use bundle install --path=vendor/bundle on server.
Give it a try, and hope this can help.

Getting error on bundle install as (Bundler could not find compatible versions for gem "bundler")

Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (~> 1.3.5) ruby
Current Bundler version:
bundler (1.2.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running gem install bundler?
Above is the error that i am getting,already tried running 'gem install bundler'. It ran successfully,but bundle install is always throwing this error.Although its a dependancy gem,i have explicitly mentioned bundler gem in gemfile with the version 1.3.5,still getting the same error.Plz reply if anyone has come across such error or help me understand if i am doing something wrong.
you can force the bundler version in bundle install command like this:
bundle _1.2.3_ install.

bundle fails with rake error on vagrant

I've been following the railscast on setting up Vagrant with rails found here:
http://railscasts.com/episodes/292-virtual-machines-with-vagrant
I have rbenv running on vagrant with a slightly more updated version of ruby(1.9.3p125). Everything goes fine until I try to bundle. Here's the error I get:
vagrant#lucid32:/vagrant$ bundle
Fetching gem metadata from http:rubygems...
Fetching gem metadata from http:rubygems...
Resolving dependencies...
Using rake (10.0.3)
Errno::EPROTO: Protocol error - /vagrant/bin
An error occurred while installing rake (10.0.3), and Bundler cannot continue.
Make sure that gem install rake -v '10.0.3' succeeds before bundling.
I've tried gem installing that version of rake, then running rbenv rehash which seems to install, but running bundle again still gives me the same error.
I was able to resolve this by downgrading bundler from 1.3.2 to 1.2.5.
rvm use #global
gem uninstall bundler
gem install bundler -v 1.2.5
# switch back to the default gemset
rvm use
bundle install
# everything should work now
The only other thing that I changed was I reverted from rvm 1.18.19 to 1.17.10, but I am not positive that step is necessary.

Resources