user2829769
user2829769

Reputation: 121

RubyMine 7 Remote Debug No such file or directory error

I am trying to debug a rails app that is on a vagrant machine using RubyMine. I setup remote ruby sdk via settings. I installed necessary gems for debugging (ruby-debug-base, ruby-debug-ide). When it tries to start debugger it gives the following output on debugger console:

/<remote_path_to_ruby>/bin/ruby -e 'at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)' /<remote_path>/gems/ruby-debug-ide-0.4.29/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 33401 --dispatcher-port 52861 -- /<local_path>/railsapp/script/rails server -b 127.0.0.1 -p 3000 -e development
    bash: line 0: cd: /<local_path>/railsapp: No such file or directory
    /<local_path>/railsapp/Gemfile not found

is the path from vagrant machine, and is my host machine. It has the railsapp directory and Gemfile inside.

Any ideas? Thanks

Upvotes: 2

Views: 1457

Answers (2)

Alex Grin
Alex Grin

Reputation: 3213

I had the same error with WSL2 in RubyMine 2020. The accepted answer above pointed me in the right direction. I also use rbenv within WSL.

In the current versions of RubyMine there's no "Remote interpreter host" config (at least not for WSL), so I had to define "Project Path Mappings" in "Ruby SDK and Gems" section, for my ruby interpreter, by clicking on that folder icon:

screenshot

I specified mapping like this (replace username with your own user folder, and replace Ubuntu-20.04 with your distro):

Local Path
//wsl$/Ubuntu-20.04/home/username

Remote Path
/home/username

This worked because both .rbenv and my project directory are there in my home/username folder. Otherwise I'd have to specify additional mappings for the project and .rbenv.

Not sure why it didn't work out of the box, without this manual mapping. Maybe I messed some configurations in my project earlier, and it would work with a fresh version. Anyway, this solved the problem for me, and hopefully will help others who search by the same error text.

Upvotes: 1

user2829769
user2829769

Reputation: 121

I figured out the problem. You need to add a mapping for your local project root -> remote project root. You can add that in debug configurations. It solved problem for me.

Upvotes: 2

Related Questions