small medium large xlarge

Generic-user-small
02 May 2017, 08:10
Mark (6 posts)

I had to update my Gemfile as received the following error and googling revealed option to update gems.

  • rack 2.0.1
  • sinatra 2.0.0.rc2

Here is the original failure

An error occurred while loading ./spec/acceptance/expense_tracker_api_spec.rb.
Failure/Error: require 'sinatra/base'

Gem::ConflictError:
  Unable to activate sinatra-1.4.8, because rack-2.0.1 conflicts with rack (~> 1.5)
# ./app/api.rb:1:in `<top (required)>'
# ./spec/acceptance/expense_tracker_api_spec.rb:3:in `require_relative'
# ./spec/acceptance/expense_tracker_api_spec.rb:3:in `<top (required)>'
# ------------------
# --- Caused by: ---
# LoadError:
#   cannot load such file -- sinatra/base
#   ./app/api.rb:1:in `<top (required)>'
No examples found.


Finished in 0.00026 seconds (files took 0.27649 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

Initially this failed

bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "rack":
  In snapshot (Gemfile.lock):
    rack (= 1.6.5)

  In Gemfile:
    sinatra (= 2.0.0.rc2) was resolved to 2.0.0.rc2, which depends on
      rack-protection (= 2.0.0.rc2) was resolved to 2.0.0.rc2, which depends on
        rack

    rack-test (= 0.6.3) was resolved to 0.6.3, which depends on
      rack (>= 1.0)

    sinatra (= 2.0.0.rc2) was resolved to 2.0.0.rc2, which depends on
      rack (~> 2.0)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

So I ended up running bundle update which resolved the issue

bundle update
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using coderay 1.1.0
Using diff-lcs 1.3
Installing mustermann 1.0.0
Using rack 2.0.1 (was 1.6.5)
Using rspec-support 3.6.0.beta2
Using tilt 2.0.7
Using bundler 1.13.6
Installing rack-protection 2.0.0.rc2 (was 1.5.3)
Using rack-test 0.6.3
Using rspec-core 3.6.0.beta2
Using rspec-expectations 3.6.0.beta2
Using rspec-mocks 3.6.0.beta2
Installing sinatra 2.0.0.rc2 (was 1.4.8)
Using rspec 3.6.0.beta2
Bundle updated!

The tests now pass

➜  expense_tracker rspec
.

Finished in 0.03895 seconds (files took 0.37131 seconds to load)
1 example, 0 failures

`raise_if_conflicts’: Unable to activate sinatra-1.4.8, because rack-2.0.1 …

Myron-profile-img_pragsmall
03 May 2017, 05:49
Myron Marston (7 posts)

Thanks for reporting this, Mark. We plan to upgrade the book to Sinatra 2.0 if it is out before we publish, but for now we are targeting Sinatra 1.4.8.

It sounds like you found a solution that works for you, but if it happens again and you want us to look at what you’ve got, let us know. If you want us to troubleshoot, it would help if you could push your code base up to github or bitbucket.

Generic-user-small
07 May 2017, 21:16
Mark (6 posts)

Hi Myron

I have attempted to recreate this, but cannot. I believe it was an error after I installed ruby 2.3.3 and had not performed rbenv rehash.

All seems to be working now, under both ruby MRI 2.3.3 and MRI 2.4.0

Thank you for the quick response.

I’m enjoying working through the book.

P.S. Not sure If I should delete the original post as it was User Error

You must be logged in to comment