Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a Rails app on a different port (not default port 3000) on VS Code on MacOS

I'm on MacOS Sierra and use rbenv.

Here is my configuration for my Rails server configuration:

{
    "name": "Rails server",
    "type": "Ruby",
    "request": "launch",
    "cwd": "${workspaceRoot}",
    "useBundler": true,
    "program": "${workspaceRoot}/bin/rails",
    "args": [
        "server"
    ]
}

I've tried the following values for the "args" key:

"args": [
    "server",
    "-p 4002"
]

But I would get the following error:

Exiting
bundler: failed to load command: rdebug-ide (/Users/knockycode/vendor/bundle/bin/rdebug-ide)
Uncaught exception: cannot load such file -- rack/handler/-p 4002
like image 214
Key007 Avatar asked Oct 18 '25 17:10

Key007


1 Answers

I figured out that -p 4002 contains TWO arguments: the -p flag, and 4002 flag value; it's not one whole argument.

The working configuration:

{
    "name": "Rails server",
    "type": "Ruby",
    "request": "launch",
    "cwd": "${workspaceRoot}",
    "useBundler": true,
    "program": "${workspaceRoot}/bin/rails",
    "args": [
        "server",
        "-p",
        "4002"
    ]
}
like image 146
Key007 Avatar answered Oct 20 '25 08:10

Key007



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!