How to overcome Bundle resolve conflict when running specs - ruby-on-rails

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...

Related

Bundler 2 won't run rspec

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

Windows, Ruby on rails bundle installer issue

I've no idea what happened, but I've started getting this error:
c:\Sites\Project>ruby bin/rails server
Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile.
If you haven't changed sources, that means the author of rake (12.0.0) has removed it.
You'll need to update your bundle to a different version of rake (12.0.0) that hasn't been removed in order to install.
Run `bundle install` to install missing gems.
I've been using railsinstaller 2.3, and after getting it switched over to 2.2, but it is not helping.
Running bundle install produces exact same error text.
Ran
gem install rubygems-bundler
gem regenerate_binstubs
then
bundle install

Running rake db:migrate gives "Could not find coffee-script-source-1.3.3 in any of the sources" error

I just made a fresh Rails app (Rails v3.2.8) and tried running rake db:migrate with one migration, but I always get this error:
Could not find coffee-script-source-1.3.3 in any of the sources
Run `bundle install` to install missing gems.
However, when I run bundle install, it indicates that coffee-script-source-1.3.3 is already installed:
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
....
Using coffee-script-source (1.3.3)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Any ideas? If it helps, I am also running ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0], which I installed via brew install ruby
Edit: I am not using rvm
It's possible that the rake task is not being executed in the context of your current bundle (specified by your Gemfile). To ensure your task is running in the proper context, run bundle exec rake db:migrate instead.
Running executables via bundle exec is considered to be the safest route as it guarantees that only the gems at versions you expect (ie: what is declared in your Gemfile.lock) will be used.
Source: bundle-exec man page

Need to uninstall rake 0.9.2.2 and install rake 0.8.7

I built a new clean VM, install rvm, and installed ruby 1.9.2 and ran gem install rails --version '=3.0.7'. So far so good. When I did gem list rake, I saw that rake 0.9.2.2 was installed and I need rake 0.8.7. I read up on uninstalling rake. Then installed gem install rake -v='0.8.7'. This is what I did and observed:
gem list rake
rake (0.9.2.2, 0.8.7)
gem uninstall rake 0.9.2.2
You have requested to uninstall the gem rake-0.8.7
.......
Continue [Yn]
Successfully unistalled rake 0.8.7
INFO: gem "0.9.2.2" is not installed
gem list rake
rake (0.9.2.2)
Ok so it shows both versons of rake installed at first, I specify to delete 0.9.2.2 and it says its uninstalling 0.8.7 and that it completed uninstalling 0.8.7. (Not what I entered) At the end it shows 0.9.2.2 still installed in gem list rake. I have gone through this iteration multiple times, same result every time.
In the end, I need Ruby 1.9.2; rails 3.0.7 and rake 0.8.7. The first two I have fine. But how do I get rake back to 0.8.7? Or is what I see just some trash left over in some inventory of gems and does not reflect reality? or can you be sure what you really have?
Thanks in advance.
Try using the following command
rvm use #global && gem uninstall rake
I was having this same issue with the predefined constatnts 'Ruby' & 'LN_SUPPORTED'.
However; my 'gem list' only was showing rake 0.9.2.2. So after I was able to install 0.8.7, everything started working again.
sudo gem install rake -v=0.8.7
Can you do a: sudo gem uninstall Rake without specifying a version to get rid of rake completely before trying to reinstall both versions? Or possibly (I know it's frowned upon, but... ) remove the rake gem folder?
Also, maybe you could add rake (0.9.2.2, 0.8.7) to your gemfile and then do a bundle update
This works for me:
gem uninstall rake --version 0.9.2.2

Trouble removing rake 0.9

I am having some trouble removing the rake gem version 0.9. I managed to run gem uninstall rake and I believed this to have deleted it. However, going back to gem list it still showed that it still exists.
Running gem env:
GEM PATHS:
/home/sean/.rvm/gems/ruby-1.9.2-p180
/home/sean/.rvm/gems/ruby-1.9.2-p180#global
I went into the #global directory and manually deleted it there, yet still it remains somewhere. I can see it when I run gem list. The 0.9 rake gem is causing problems for my Rails 3.0.7 application.
I ran gem list -d rake:
rake (0.9.0, 0.8.7)
Installed at
(0.9.0): /home/sean/.rvm/gems/ruby-1.9.2-p180#global
(0.8.7): /home/sean/.rvm/gems/ruby-1.9.2-p180
I don't see anything in the gems directory for ruby-1.9.2-p180#global
You should run
rvm use #global && gem uninstall rake -v 0.9.0
rvm use # && gem uninstall rake -v 0.9.0
to correctly remove rake 0.9.0 from rvm
In terminal type in: gem uninstall rake, then select version 0.9.0 when prompted.
Then modify your Gemfile within your Rails application:
gem 'rake', '0.8.7'
Then in terminal run:
bundle install
These steps should fix the problems you are having. Upgrade to rake again when you upgrade to rails 3.1.
If you're using rvm you get rake 0.9 installed "for free" in the global gemset which makes it hard (impossible?) to uninstall properly. gem uninstall rake is successful but doesn't actually remove rake 0.9. I had to do it manually for both REE and 1.9.2.
I edited the rake executable script (find with which rake) and added a:
puts "Gem.bin_path: #{Gem.bin_path('rake', 'rake', version)}
...before the last line. This prints (on my system):
Gem.bin_path: ~/.rvm/gems/ree-1.8.7-2011.03#global/gems/rake-0.9.0/bin/rake
To remove 0.9 cd into ~/.rvm/gems/ree-1.8.7-2011.03 and manually delete all rake-0.9 files (gems, specifications are the ones that count I believe).
I ran into this same problem (needed rake 0.8.7 but got 0.9.0 "for free" with rvm). Initially gem list -d rake gave the following output:
rake (0.9.0, 0.8.7)
Installed at (0.9.0): ~/.rvm/gems/ruby-1.9.2-p136#global
(0.8.7): ~/.rvm/gems/ruby-1.9.2-p136#my_gemset
Switching to the global gemset with rvm use #global gave me this output:
rake (0.9.0)
Installed at: ~/.rvm/gems/ruby-1.9.2-p136#global
So I just did gem uninstall rake. Now, switching back to my gemset with rvm use #my_gemset the correct version of rake (0.8.7) is being used.
If you're using bundler, you should read this excellent article by Yehuda Katz. Following his instructions means you don't have to uninstall rake 0.9.0. Try following command:
bundle exec rake --version
Prepending bundle exec will make sure that only the correct version of the rake is loaded, regardless of others you have installed.
Did you try using the 'gem cleanup' script ?

Resources