How can you launch Ruby on Rails using the built-in Visual Studio Code Launch/Debug features?
How do you fix the Debugger terminal error: Process
I spent most of a day trying to solve this.
I ended up stripping my launch.json config down to the following:
"configurations": [
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "/Users/mitch/.rvm/gems/ruby-2.3.0@gg_portal/bin/rails",
"args": [
"server"
],
"useBundler": true,
"pathToRDebugIDE": "/Users/mitch/.rvm/gems/ruby-2.3.0@gg_portal/gems/ruby-debug-ide-0.6.1",
"pathToBundler": "/Users/mitch/.rvm/gems/ruby-2.3.0@gg_portal/wrappers/bundle",
"showDebuggerOutput": true
}
]
Firstly, especially if you're using RVM & have different Gemsets, make sure your paths are consistent with the correct Gemset.
What solved the problem for me was pathToBundler.
which bundle
/Users/mitch/.rvm/gems/ruby-2.3.0@gg_portal/bin/bundle
There looks to be some incompatibility around setting the path to the binstubs bundler (shown above) and the bundler pointed to from /wrappers/ (shown below), so changing pathToBundler to:
"pathToBundler": "/Users/mitch/.rvm/gems/ruby-2.3.0@gg_portal/wrappers/bundle",
solved the problem.
There is a kind of related discussion here:
https://github.com/rails/rails/issues/31193
which talks about binstubs though not specifically VSCode & debugging.