【问题标题】:Debugging TypeScript on VSCode在 VSCode 上调试 TypeScript
【发布时间】:2016-02-05 01:03:12
【问题描述】:

我正在尝试使用 Visual Studio Code 调试以下打字稿代码:

class Student {
    fullname : string;
    constructor(public firstname, public middleinitial, public lastname) {
        this.fullname = firstname + " " + middleinitial + " " + lastname;
    }
}

interface Person {
    firstname: string;
    lastname: string;
}

function greeter(person : Person) {
    return "Hello, " + person.firstname + " " + person.lastname;
}

var user = new Student("Jane", "M.", "User");

console.log(greeter(user));

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

{
    "version": "0.1.0",
    // List of configurations. Add new configurations or edit existing ones.
    "configurations": [
        {
            // Name of configuration; appears in the launch configuration drop down menu.
            "name": "TypeScriptDebugTest",
            // Type of configuration.
            "type": "node",
            // Workspace relative or absolute path to the program.
            "program": "./HelloWorld.ts",
            // Automatically stop program after launch.
            "stopOnEntry": false,
            // 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,
            // Optional arguments passed to the runtime executable.
            "runtimeArgs": ["--nolazy"],
            // Environment variables passed to the program.
            "env": {
                "NODE_ENV": "development"
            },
            // Use JavaScript source maps (if they exist).
            "sourceMaps": true,
            // If JavaScript source maps are enabled, the generated code is expected in this directory.
            "outDir": "./built"
        }
    ]
}

javascript 编译文件位于根目录下的 build 文件夹中。当我尝试调试时,同样的错误不断出现:“无法连接到运行时进程(5000 毫秒后超时)”

注意:我想调试的是 .ts 文件,而不是编译后的 javascript。

有谁知道如何解决这个问题?

谢谢!

【问题讨论】:

  • 这是节点 4.x 的吗?
  • 是的@BenjaminPasero 我正在使用节点 4.x

标签: debugging typescript visual-studio-code


【解决方案1】:

我们的下一个版本将支持调试节点 4.x。敬请期待!

【讨论】:

  • 这是否意味着 0.10.0 测试版?我在尝试使用 vscode 0.10.0 中的 Node v4.2.1 调试 VSCod 扩展时遇到了同样的问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-11-08
  • 2019-10-28
  • 2017-09-23
  • 2016-10-30
  • 2017-05-29
  • 2020-10-09
  • 2017-04-28
相关资源
最近更新 更多