If you are working on a gem that uses slop itself (your gem uses slop) then you might run into this error when adding pry. Because the latest published pry gem uses slop 3.6 but you are probably using slop 4. Slop 4 and 3 aren’t the same API.
bundle install you’ll probably get a different error.
This is true for pry
0.10.2 too. There are two options I’ve found that works:
tl;dr Do this
Install 0.10.3 or newer. Make sure your bundle is resolving to that exact version. This means
in your Gemfile. If you are working on a gem and don’t really have a Gemfile but have a gemspec file then put this dev dependency in your gemspec.
Install From Master
You could also install pry from github master. This might show up as 0.10.3 depending on when you are reading this. Version numbers only increment when pry does a release. I found that pry git master did not have this issue.
Now the problem here is, if you are working on a gem yourself, you don’t have a
Afaik, you can’t install a gem from github source instead of a gemspec (that wouldn’t make sense
because you are going to distribute a gem!). But perhaps, you maybe want pry
temporarily in your gemspec like this:
Here’s how you can install a gem from source in a gemspec temporarily.
Now we have pry 0.10.3. Bundle doesn’t care it came from pry master. So when it
picks up on the
spec.add_development_dependency it will install the version
you already have. BUT BIG PROBLEM You probably don’t want to commit this
because people will get the same error you got on bundle install if
that version doesn’t resolve. As far as I can tell, this pry version
works with slop so perhaps you just want to use 0.10.3 and be done with this.
I just wanted to illustrate how you can manipulate bundler.
Pry Vendored Slop
The reason this is happening is because of the slop namespace.
Pry fixed this in a commit associated with that issue. It’s fixed because they inlined
the gem as
Pry::Slop so now
Slop (your version) doesn’t conflict/activate.
Hope this saves someone’s day! :)