【问题标题】:rdebug-ide with VSCODE returns cannot load such file -- /app/app/rails error带有 VSCODE 的 rdebug-ide 无法加载此类文件 -- /app/app/rails 错误
【发布时间】:2020-10-19 13:24:45
【问题描述】:

我有一个 dockerized RoR 应用程序,我正在尝试使用 rdebug-ide 和 vscode 在调试模式下运行它。 已经添加了宝石 ruby​​-debug-ide 和 debase。 我在 vscode 上安装了 ruby​​ 扩展并创建了启动配置:

"version": "0.2.0",
"configurations": [
    {
        "name": "Attach to Docker",
        "type": "Ruby",
        "request": "attach",
        "remoteHost": "0.0.0.0",
        "remotePort": "9000",
        "remoteWorkspaceRoot": "/app",
        "cwd": "${workspaceRoot}",
        "showDebuggerOutput": true,
    }
]

在 docker-compose.override 我添加了命令:

command: bundle exec rdebug-ide --debug --host 0.0.0.0 --port 9000 -- rails s --host 0.0.0.0 -p 3000

当我运行docker-compose up backend 时,我可以看到调试服务器正在运行:

Fast Debugger (ruby-debug-ide 0.7.2, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:9000

问题发生在我在 VSCODE 上启动调试任务时。我收到此错误:

Uncaught exception: cannot load such file -- /app/rails

Dockerfile 上的入口点和工作目录:

WORKDIR /app
ENTRYPOINT ["bundle", "exec"]
CMD ["rails", "server", "--binding=0.0.0.0"]

如果我使用docker-compose up backend 正常运行应用程序并执行docker container ls 我可以看到启动命令:

bundle exec rails server --binding=0.0.0.0

【问题讨论】:

  • 我也有同样的问题!但我还没有找到解决办法。有解决办法吗?

标签: ruby-on-rails docker visual-studio-code vscode-debugger ruby-debug


【解决方案1】:

在我的情况下,rails 的路径错误,请尝试在 command 中将其更改为 bin/rails

command: bundle exec rdebug-ide --debug --host 0.0.0.0 --port 9000 -- bin/rails s --host 0.0.0.0 -p 3000

【讨论】:

  • 这对我不起作用,你有其他解决方案@zooblin 吗?
  • @MinhNguyen 有多种可能的原因,你安装了所有的 deps 吗?你看到了什么错误?我认为你最好考虑一个新问题
  • 谢谢,我自己找到了解决办法。
猜你喜欢
  • 2014-06-04
  • 2022-08-13
  • 2015-05-15
  • 2022-10-23
  • 2012-12-03
  • 1970-01-01
  • 2011-12-22
  • 2023-03-30
  • 1970-01-01
相关资源
最近更新 更多