-
Notifications
You must be signed in to change notification settings - Fork 286
"Debugger terminal error: Process failed: spawn rdebug-ide ENOENT" when trying to debug #214
Comments
UPDATE: Found workaround with this comment. Looks like my ENV isn't getting passed to VS Code. Launching VS Code from the command line let's me debug:
I tested with a breakpoint in a controller I made it was hit no problem. So then the only problem at this point is that my ENV isn't working in VS Code. Any idea what could cause this? |
+1 I ran into this same problem today. I was able to rectify the problem by adding a couple environment variables to my |
@aryeh-looker I've added EDIT: Ok, I didn't think this would do anything but I added my
|
Based on this comment, #62 (comment) from hickey, this is my actual configuration to debug my Rails application:
The trick is trying to replicate the same environment as if you were doing a
from your project folder into the terminal, to prevent conflicts with another ruby version or particular gem. You can get all information relative to gem paths executing If you want to do a new setup for another project in your workspace with another gemset or ruby version you will need to adjust the ENV values with the particular project paths, etc... It's a bit complicated but it works. Hope this helps. |
Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience. |
Here is a quick bash printf command to give you the required env details to place into
|
I have a similar problem, but I am using rbenv instead of rvm, so I don't have any of those environment variables. My debugging setup also works fine when launching from the command line as opposed to my taskbar. Am I out of luck and need to switch to rvm or is there a solution that would allow me to use rbenv without having to launch vscode from the command line? EDIT: I don't know what was different this time but I added my PATH to my launch.json file and all of a sudden it works now. I was pretty sure I tried that and it didn't work but I must have made a mistake I didn't notice earlier. |
Had the exact problem! Thanks @timkrins 🎉 This should be resolved somehow - is there a way of passing all ENVs to code or the plugin itself? |
@leggettc18 can you share your |
Just in case anyone else stumbles upon this (since I just spent about 30 min debugging), make sure that your env is specified inside the configuration object (not outside). e.g. {
// 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",
"env": {
"PATH": "/Users/et/.gem/ruby/2.5.3/bin:/Users/et/.rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/bin:/Users/et/.rubies/ruby-2.5.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/et/.rvm/bin:/Users/et/.rvm/bin",
"GEM_HOME": "/Users/et/.gem/ruby/2.5.3",
"GEM_PATH": "/Users/et/.gem/ruby/2.5.3:/Users/et/.rubies/ruby-2.5.3/lib/ruby/gems/2.5.0",
"RUBY_VERSION": "2.5.3"
}
}
]
} |
very helpful thanks! |
As an alternative to specifying your env inside the launch.json file, try starting VSCode from the terminal instead of from e.g. the Dock on macOS. This will ensure that any processes spawned by VSCode will inherit the environment variables defined in the terminal session. Credit goes to the following comment for this workaround. |
Try to make a imperfect conclusion about
First Second Third
It did help me, thank u
|
I still see this error message even if I set the proper environment for the launch configuration. I also tried |
I fixed it by putting env PATH into launch.js, so mine is like this and is working fine:
|
@AlesLulak Thanks, but I have already put the proper |
For all people hitting this error on Windows, despite adding PATH to ENV in launch.json, mind this: https://stackoverflow.com/a/54993121/717732 - check the spelling of PATH on your OS! |
anyone share lauch.json with rbenv? |
@nighttiger1990 I use
notable bits:
|
Thank you!!! |
In my case, I need to use
|
Even though i see ruby-debug-ide in the gem list, when i do "which ruby-debug-ide" it doesn't recognize it. |
— worked like a charm. Found this Stack Overflow question helpful as well https://stackoverflow.com/a/56810833/8062488 |
I've just installed rbenv and found that I have no $GEM_PATH nor $GEM_HOME env vars. So, had to use this workaround:
|
Your environment
vscode-ruby
version: 0.15.0Make sure you have
ruby
,ruby-debug-ide
andruby-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:
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:
So I performed these installs and made sure they were in my gems:
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:
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:
In the wiki, I noticed these instructions:
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: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:
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:
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.
The text was updated successfully, but these errors were encountered: