Sauronlord
Sauronlord

Reputation: 237

How to install a working debugger in Sublime Text 3 for debugging Rails 4.2 (Ruby 2.1.4) Apps?

I've installed the latest version of Sublime Text 3 and https://github.com/shuky19/sublime_debugger.

I've followed the instructions, however when I run the debugger, I get the following error:

/Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs/runtimes.rb:65:in `from_environment': Node.js (V8) runtime is not available on this system (ExecJS::RuntimeUnavailable)

Everything works fine when I run 'rails s' directly on the command line.

Here's the console output. The stack trace gets triggered when I try to make a request to the server with my browser.

Started process command: bash -c "'/Users/sauron/Library/Application Support/Sublime Text 3/Packages/Ruby Debugger/ruby_executor.sh' 'rvm' True  '-C/Users/sauron/git/sja' '-r/Users/sauron/Library/Application Support/Sublime Text 3/Packages/Ruby Debugger/sublime_debug_require.rb' '-rbundler/setup'   '/Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails' s"
Connecting... 

----------------------------------------
------------Ruby Executor---------------
----------------------------------------
Method: RVM
Using ruby version: ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin13.0]
Located at: /Users/sauron/.rvm/rubies/ruby-2.1.4/bin/ruby
Ruby Arguments = -C/Users/sauron/git/sja -r/Users/sauron/Library/Application Support/Sublime Text 3/Packages/Ruby Debugger/sublime_debug_require.rb -rbundler/setup /Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails s

Connected
/Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs/runtimes.rb:65:in `from_environment': Node.js (V8) runtime is not available on this system (ExecJS::RuntimeUnavailable)
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs/runtimes.rb:50:in `autodetect'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/execjs-2.2.2/lib/execjs.rb:4:in `<top (required)>'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `require'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/uglifier-2.7.0/lib/uglifier.rb:3:in `<top (required)>'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `require'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `each'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `each'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `require'
    from /Users/sauron/.rvm/gems/ruby-2.1.4@global/gems/bundler-1.7.6/lib/bundler.rb:133:in `require'
    from /Users/sauron/git/sja/config/application.rb:15:in `<top (required)>'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/sauron/git/sja/bin/rails:8:in `require'
    from /Users/sauron/git/sja/bin/rails:8:in `<top (required)>'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `load'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `call'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client/command.rb:7:in `call'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/client.rb:26:in `run'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/bin/spring:48:in `<top (required)>'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `load'
    from /Users/sauron/.rvm/gems/ruby-2.1.4/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/sauron/git/sja/bin/spring:16:in `require'
    from /Users/sauron/git/sja/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'
Debugger stopped

Upvotes: 2

Views: 3517

Answers (1)

Sauronlord
Sauronlord

Reputation: 237

Looks like I found the answer with a bit of searching on Stack overflow. See: https://stackoverflow.com/a/24020042/2091901

I'm guessing that the runtime scripts for Sublime Text 3 debugger in question sets the environment variables and has an incorrect reference to the location of node.

In short, I created the following symlink and all is good:

ln -s /usr/local/bin/node /usr/bin/node

Actually. This does not completely solve my problem. I now get this error when servicing a request:

Connected /Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails:19: syntax error, unexpected '=', expecting keyword_end Last exception: # /Users/sauron/.rvm/gems/ruby-2.1.4/bin/rails:23: syntax error, unexpected end-of-input, expecting keyword_end

Upvotes: 1

Related Questions