Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't escape from eval with next #20

Closed
sam452 opened this issue Jun 5, 2013 · 20 comments
Closed

Can't escape from eval with next #20

sam452 opened this issue Jun 5, 2013 · 20 comments

Comments

@sam452
Copy link

sam452 commented Jun 5, 2013

I believe I've followed the steps to plug in pry-nav into my Gemfile in Rails. As a plug-in to pry, I'm unaware of anything else to do but 'next' yields this syntax error. 'step' yields undefined local variable for 'step.' I've found nothing else on Google of what I'm missing.

@nixme
Copy link
Owner

nixme commented Jun 6, 2013

What versions of pry and pry-nav are locked in your Gemfile.lock?

Also, if you're using ruby 1.9.2, 1.9.3, or 2.0, you should switch to pry-debugger https://github.com/nixme/pry-debugger

@sam452
Copy link
Author

sam452 commented Jun 6, 2013

Oh, thanks for asking:

pry (0.9.12.1)
coderay (> 1.0.5)
method_source (
> 0.8)
slop (> 3.4)
pry-nav (0.2.3)
pry (
> 0.9.10)
pry-remote (0.1.7)
pry (> 0.9)
slop (
> 3.0)
pry-stack_explorer (0.4.9)
binding_of_caller (>= 0.7)
pry (~> 0.9.11)

thx, sam

On Jun 5, 2013, at 7:39 PM, Gopal Patel [email protected] wrote:

What versions of pry and pry-nav are locked in your Gemfile.lock?

Also, if you're using ruby 1.9.2, 1.9.3, or 2.0, you should switch to pry-debugger https://github.com/nixme/pry-debugger


Reply to this email directly or view it on GitHub.

@nixme
Copy link
Owner

nixme commented Jun 6, 2013

How are you running pry? via binding.pry inside some code while your app server is running? Or by running "pry" from the shell. If the latter, are you running through a bundler-aware mechanism? e.g. "bundle exec pry" or if you've binstubbed it "bin/pry" in the root of your project?

@sam452
Copy link
Author

sam452 commented Jun 6, 2013

This may be a repost from earlier.
I'm running

binding.pry
inside my create method in my Rails app.
Since I'm running 1.9.3 I ditched the
pry-nav
in favor of
pry-debugger
. I bundle install and update. I was surprised to find the same error. Here is my updated Gemfile.lock:

pry (0.9.12.2)
  coderay (~> 1.0.5)
  method_source (~> 0.8)
  slop (~> 3.4)
pry-debugger (0.2.2)
  debugger (~> 1.3)
  pry (~> 0.9.10)
pry-remote (0.1.7)
  pry (~> 0.9)
  slop (~> 3.0)
pry-stack_explorer (0.4.9)
  binding_of_caller (>= 0.7)
  pry (~> 0.9.11)

@rdaniels
Copy link

rdaniels commented Feb 5, 2014

I'm having this same issue when i run RSpec with a binding.pry in the code:

[2] pry(#<ShippingQuote::Shipping>)> next
SyntaxError: (eval):2: Can't escape from eval with next

@nixme
Copy link
Owner

nixme commented Feb 5, 2014

Unfortunately, somehow the ruby "next" keyword is getting invoked instead of the pry command. Can you try adding an alias for next: Pry.commands.alias_command 'n', 'next' and then running n instead?

@ndavis
Copy link

ndavis commented Mar 10, 2014

Pry.commands.alias_command 'n', 'next' RuntimeError: Command: 'next' not found from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/pry-0.9.12.2/lib/pry/command_set.rb:216:in 'alias_command'

@toppsdown
Copy link

Seeing the same issue:

next
SyntaxError: (eval):2: Can't escape from eval with next

Pry.commands.alias_command 'n', 'next'
RuntimeError: Command: next not found
from /Users/Ethan/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/pry-0.9.12.2/lib/pry/command_set.rb:216:in `alias_command'

@b-raines
Copy link

Had this same issue for the past month and still haven't figured it out.

@matthewbga
Copy link

Ditto here.

@mitchcail
Copy link

ya me too

@lilliealbert
Copy link

Ditto.

@stephan-nordnes-eriksen

+1

@stephan-nordnes-eriksen

Might have figured it out: In my case I was using "require 'pry'". But since I was running ruby 2.0+ I needed to use require 'pry-byebug'.

In other words: you might be using the wrong version of pry to ruby.

Ruby 1.9.2/1.9.3 => https://github.com/nixme/pry-debugger
Ruby 2.0+ => https://github.com/deivid-rodriguez/pry-byebug

deivid-rodriguez pushed a commit to deivid-rodriguez/byebug that referenced this issue Aug 14, 2014
There are several reasons for this:
- `next` command inside `irb` never really worked, because the `next`
keyword in Ruby would get executed instead (see
nixme/pry-nav#20)
- Commands were very limited, they couldn't handle any arguments like
the regular `next`, `step` and `cont` commands.
- It causes issues with the Rails console (see
[deivid-rodriguez/pry-byebug#30).
@Kshitij-Banerjee
Copy link

In my case, pry did not have the next command and was using the ruby method.

check that next command is present in Pry.commands

@omgreenfield
Copy link

I have switched to pry-debugger and it was also throwing this error.

I checked Pry.commands during execution and like @Kshitij-Banerjee pointed out, I didn't have the 'next' or 'step' commands.

I added gem 'pry' and gem 'pry-debugger' (even though nowhere in the documentation did it suggest this). Ran a bundle install, and when I ran Pry.commands again, next was there! And next indeed worked!

@Kshitij-Banerjee
Copy link

@GosuSheep nice.

@mpelzsherman
Copy link

Hit the same issue with ruby 2.2.1. Replacing gem 'pry' with gem 'pry-byebug' worked for me.

@matthewbga
Copy link

Yes, same here.

@xasos
Copy link

xasos commented Jul 28, 2015

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests