We recently updated bundler to 2.0.1 in our project. After the update the app runs fine but I can't run rspec. It does run on my co-workers computer which should be pretty identical setup to mine's.
What I tried:
bundler update --bundler => completes successfully
gem update bundler => completes successfully
bundle exec bin/rspec => Error: You must use Bundler 2 or greater with this lockfile.
bin/rspec => Error: You must use Bundler 2 or greater with this lockfile.
bundle -v => Bundler version 2.0.1
bundle exec bundler -v => Bundler version 2.0.1
bundle exec rake app:update:bin => completes successfully
Some versions:
rspec 3.7.0
ruby 2.4.1p111
I think the issue was with my default version of bundler. You can see that with gem list bundler.
I ended up uninstalling ruby and re-installing it, followed by a fresh installation of bundler 2 and all the other gems. Fixed it.
You can try remove Gemfile.lock and run bundle install, after that try again running the command: bundle exec rspec
Related
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.
After installing Sidekiq on Centos, I try to launch Sidekiq (it's used by Sidekiq), using command:
bundle exec sidekiq
But then I get:
tupromail#be-s2534-msl:~/cuttlefish-master$ bundle exec sidekiq
Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
bundler: command not found: sidekiq
Install missing gem executables with `bundle install`
Point is that Sidekiq was installed, I see it when I run
bundle install
I see:
Using sidekiq 3.3.0
Also, it seems that Sidekiq executables are there:
tupromail#be-s2534-msl:~/cuttlefish-master$ gem uninstall sidekiq
Remove executables:
sidekiq, sidekiqctl
in addition to the gem? [Yn]
Any idea?
Update bundler to the latest version, then:
bundle install sidekiq
then try again, this issue happened because the bundler version is not the same as the one in the Gemfile.lock
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.
I just added rspec but get a bundler conflict when I try and run the specs, this does not happen if I run rake tasks or start the server.
bundle exec spec
/<snip>/gems/bundler-1.0.21/lib/bundler/resolver.rb:280:in `resolve': You have requested: (Bundler::GemNotFound)
nokogiri >= 0
The bundle currently has nokogiri locked at 1.5.0.
Try running `bundle update nokogiri`
I've tried running bundle update nokogiri and removing Gemfile.lock and rerunning bundle install. I've even tried rvm gemset empty and starting afresh.
Gemfile: https://gist.github.com/1342979
Gemfile.lock: https://gist.github.com/1342981
JRuby: 1.6.2
Rails: 3.0.10
Bundler: 1.0.21
It seems running rspec instead of spec works...