Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

"Debugger terminal error: Process failed: spawn rdebug-ide ENOENT" when trying to debug #214

@mattwelke

Description

@mattwelke

Your environment

  • vscode-ruby version: 0.15.0
  • Ruby version: 2.4.2
  • VS Code version: 1.16.1
  • Operating System: Antergos
  • Hardware (optional): Intel Core i5 system with integrated Intel graphics

Make sure you have ruby, ruby-debug-ide and ruby-debug-basex19 installed before submitting your issue -- thank you !

I have ruby-debug-ide installed but I cannot install the ruby-debug-base gem. It says it cannot find it in a repository. I think this instruction might be outdated since the wiki says to install the "debase" gem if we have Ruby 2.0 or higher.

Expected behavior

Able to launch debugging.

Actual behavior

Debugging doesn't launch. VS Code output console says:

Debugger terminal error: Process failed: spawn rdebug-ide ENOENT

Steps to reproduce the problem

I followed the installation instructions including installing the dependencies. I installed the VS Code extension "ruby" and then I saw these instructions for dependencies:

If you are using Ruby v2.x
gem install ruby-debug-ide -v 0.4.32 or higher versions
gem install debase -v 0.2.1 or higher versions

So I performed these installs and made sure they were in my gems:

$ gem list | grep "ide"
ruby-debug-ide (0.6.0)
$ gem list | grep "debase"
debase (0.2.2.beta10, 0.2.1)
debase-ruby_core_source (0.9.10)

I then followed the instructions to create the "launch.json" file automatically by going to the debug area of VS Code and choosing Ruby. My launch.json file looks like this right now:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Local File",
            "type": "Ruby",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/main.rb"
        },
        {
            "name": "Listen for rdebug-ide",
            "type": "Ruby",
            "request": "attach",
            "cwd": "${workspaceRoot}",
            "remoteHost": "127.0.0.1",
            "remotePort": "1234",
            "remoteWorkspaceRoot": "${workspaceRoot}"
        },
        {
            "name": "Rails server",
            "type": "Ruby",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/bin/rails",
            "args": [
                "server"
            ]
        },
        {
            "name": "RSpec - all",
            "type": "Ruby",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/bin/rspec",
            "args": [
                "-I",
                "${workspaceRoot}"
            ]
        },
        {
            "name": "RSpec - active spec file only",
            "type": "Ruby",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/bin/rspec",
            "args": [
                "-I",
                "${workspaceRoot}",
                "${file}"
            ]
        },
        {
            "name": "Cucumber",
            "type": "Ruby",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/bin/cucumber"
        }
    ]
}

However, when I select "Rails server" as a debug option and click the green arrow, it starts and closes immediately and I get the following message in the output console:

Debugger terminal error: Process failed: spawn rdebug-ide ENOENT

In the wiki, I noticed these instructions:

Using rvm

The default rvm will be used to run the debugger, which can lead to unexpected results if your default differs from the ruby version configured for your repo. The workaround is to change rvm's default ruby version to match the repo's expected version. In a terminal, type rvm use <ruby-version> --default to get things working. Once this is done, specifying the bundler & rdebug-ide paths is no longer required, and things load properly.

Since I use RVM, I used the rvm use 2.4.2 --default command so that my terminal would always have a Ruby selected.

Unfortunately, this did not fix the issue with VS Code debugging.

This is the RVM-related section of my .bashrc file that I had to set to get my terminal to be ready for Ruby commands when it launches:

# Fixes the "rvm is not a function"
source $HOME/.rvm/scripts/rvm

# Add RVM to PATH for scripting. Make sure this is the last PATH variable chang.
export PATH="$PATH:$HOME/.rvm/bin"

I noticed that the error message mentions an "rdebug-ide" gem so I checked my terminal to see if it could at least find this gem, I'm wondering if it could be PATH issues:

$ which rdebug-ide
/home/mwelke/.rvm/gems/ruby-2.4.2/bin/rdebug-ide

I notice the debug environment "Rails server" is attempting to run a binary in "bin" directory so I also checked to ensure I have that binary there:

├── bin
│   ├── bundle
│   ├── bundler
│   ├── byebug
│   ├── listen
│   ├── nokogiri
│   ├── puma
│   ├── pumactl
│   ├── rackup
│   ├── rails
│   ├── rake
│   ├── sass
│   ├── sass-convert
│   ├── scss
│   ├── setup
│   ├── spring
│   ├── sprockets
│   ├── thor
│   ├── tilt
│   ├── update
│   └── yarn

And it can... so I'm still pretty baffled right now. I suspect it has something to do with PATH, my setup, etc. Was wondering if anyone could help?

EDIT:

In order to discover more about what might be causing the issue, I tried to set up a debugging session using the "Listen for rdebug-ide" debugging environment. I created a script and called "rdebug-ide" from the terminal to look at a test script I made. I then started debugging this way from VS Code and it was able to start. It seemed to work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions