Debug support on VsCode

Hello there.

I’ve been trying to set up the debugger for me to study Ruby on vscode with no success so far.

I am new to web development, and some stuff is sometimes hard to assimilate at first glance.

I have followed a tutorial and have ruby on rails running on my macbook and have also installed the ruby extension on vscode. I have tried many different tutorials but they are all confusing, maybe because each case is too specific, perhaps.

Could you please help me out? Thanks =)

Hello @aliosh,

Would you please share with us what problem have you encountered?

Hello @Maniac! Thanks for replying back.

Well, I have read a tutorial which consists in doing the following:

Once having VSCode and RoR set I should:

  1. install the ruby extension into VSCode;
  2. create a file called ‘.vscode’ in my applications folder.
  3. create a {} launch.json file inside .vscode folder.
  4. The JSON file looks like this:
   {
      "name": "Rails server",
       "type": "Ruby",
       "request": "launch",
       "cwd": "${workspaceRoot}",
       "program": "/Users/Dev/.rvm/rubies/ruby-2.6.3/bin/ruby",
       "args": [
           "server"
       ],
       "useBundler": true,
       "pathToRDebugIDE": "/Users/Dev/.rvm/gems/ruby-2.6.3/bin/rdebug-ide",
       "pathToBundler": "/usr/local/Cellar/ruby/2.6.5/bin/ruby",
       "showDebuggerOutput": true
   }

]}

There are some informations missing in order to have the JSON file properly set as per instructed on the tutorial:

  1. I don’t know how to find the $PATH to the bundler.

Conclusion:

I am not sure if these are the correct steps in order to have the debugger running, so could you please help me through?

My best regards!

Alright, I have just tried to locate the bunder’s path:

 ~ bundler show
Traceback (most recent call last):
	2: from /Users/Dev/.rvm/rubies/ruby-2.6.3/bin/bundler:23:in `<main>'
	1: from /Users/Dev/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/Users/Dev/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundler (Gem::GemNotFoundException)
➜  ~ 

It seems that the bundler has not been found.

I have tried placing the following path into the JSON file: 2: from /Users/Dev/.rvm/rubies/ruby-2.6.3/bin/bundler:23:in `<main>'

Then my JSON file looks like this now:

{"configurations": [
   {
      "name": "Rails server",
       "type": "Ruby",
       "request": "launch",
       "cwd": "${workspaceRoot}",
       "program": "/Users/Dev/.rvm/rubies/ruby-2.6.3/bin/ruby",
       "args": [
           "server"
       ],
       "useBundler": true,
       "pathToRDebugIDE": "/Users/Dev/.rvm/gems/ruby-2.6.3/bin/rdebug-ide",
       "pathToBundler": "/Users/Dev/.rvm/rubies/ruby-2.6.3/bin/bundler:23:in `<main>'
       ",
       "showDebuggerOutput": true
   }

]
}

Now I am getting the following message:

Debugger terminal error: Process failed: spawn /Users/Dev/.rvm/rubies/ruby-2.6.3/bin/bundler:23:in `<main>' ENOENT

Should I follow the tutorial as per on the link below for me to set up the bundler correctly?

Hey @aliosh

I’m assuming you’re using the ruby extension in vscode. Check here for instructions to get that going. In particular, this is the way you should set up your debug configuration.

Hope this helps!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs