gpt4 book ai didi

ruby - 在 VSCode (Mac OS X) 中调试 Ruby 代码时出错

转载 作者:太空宇宙 更新时间:2023-11-03 23:07:24 24 4
gpt4 key购买 nike

我正在尝试弄清楚这个新的 Visual Studio Code (VSCode) 编辑器,同时也学习 Ruby。每当我尝试调试一个简单的 ruby​​ 程序(甚至 Hello World)时,我都会收到以下错误 VSCode

Error: could not launch 'node' in debug mode

这就是我的终端中显示的内容:

/Users/Chixco/Documents/RubyProjects/FirstApp/test.rb:1
(function (exports, require, module, __filename, __dirname) { puts "Hello!"
^^^^^^^^
SyntaxError: Unexpected string
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.runMain [as _onTimeout] (module.js:501:10)
at Timer.listOnTimeout (timers.js:110:15)

这就是我配置 launch.json 文件的方式:

{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch test.rb",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "test.rb",
// Automatically stop program after launch.
"stopOnEntry": true,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": ".",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": null,
// Environment variables passed to the program.
"env": { }
},
{
"name": "Attach",
"type": "node",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858
}
]
}

有谁知道这可能是什么原因造成的吗?

附注当我在 Eclipse 中使用 Aptana Studio 插件时,没有任何问题。

最佳答案

Visual Studio Code Preview 不支持调试 Ruby。如果您希望在 VSCode 的 future 版本中看到此功能,您可以投票 here 。在上面的启动配置中,您尝试配置“node”来运行您的 ruby​​ 程序(无法工作)。

来源:我是 Visual Studio Code 团队的成员。

关于ruby - 在 VSCode (Mac OS X) 中调试 Ruby 代码时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30472845/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com