如何在MacOS上的VS Code上的不同端口(非默认端口3000)上调试Rails应用程序

时间:2018-02-11 13:07:30

标签: ruby-on-rails macos visual-studio-code

我在MacOS Sierra上使用rbenv。

以下是我的Rails服务器配置的配置:

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

我已经为" args"尝试了以下值键:

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

但我会收到以下错误:

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

1 个答案:

答案 0 :(得分:1)

我发现-p 4002包含两个参数:-p标志和4002标志值;这不是一个完整的论点。

工作配置:

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