Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code (Ruby) uncaught exception - cannot load such file

I started coding in ruby in visual studio code and I am having problems loading my file. When my file name is named main.rb which I find in launch.json under configurations "program": "${workspaceRoot}/main.rb" it loads just fine but when I change my file name to example.rb the only way I am able to run the code is if I change main.rb to example.rb in launch.json

I am sure that I am doing something wrong but I am having a tough time finding any answers on the internet to resolve this issue.

like image 357
Michael Torres Avatar asked Jun 02 '18 17:06

Michael Torres


1 Answers

Open your launch.json file and change it like this (only the value of the key "program" is changing):

Before:
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/main.rb"
}

After:
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${file}"
}

like image 187
Oli Avatar answered Oct 29 '22 02:10

Oli