【发布时间】:2015-08-08 23:18:37
【问题描述】:
我正在尝试找出这个新的 Visual Studio Code (VSCode) 编辑器,同时也在学习 Ruby。每当我尝试调试一个简单的 ruby 程序(甚至是 Hello World)时,我都会收到以下错误 VSCode
错误:无法在调试模式下启动“节点”
这就是我的终端中显示的内容:
/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 插件时,我没有任何问题。
【问题讨论】:
-
Node 是一个 JavaScript 引擎 - 列出 JavaScript 文件时出现错误(因此
.js而不是.rb)。您希望 JavaScript 引擎执行 Ruby 代码吗? -
VSCode中调试的配置说明仅参考launch.json配置。我需要知道与 VSCode 编辑器相关的具体操作,以使其调试 ruby
-
我的理解(非常基本,因为我没有在 VSCode 上花费大量时间)是它适用于使用 Node.js 进行 Web 开发,所以我冒险它不支持调试 ruby 代码.
标签: ruby node.js macos debugging visual-studio-code