2
我試圖使用Visual Studio代碼調試下面的打字稿代碼:調試打字稿上VSCode
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的編譯後的文件是在在根目錄下建立一個文件夾。當我嘗試調試相同錯誤持續ocurring:「無法連接(5000毫秒後超時)運行時的過程」
注:我要調試的.ts文件,而不是編譯的JavaScript。
有誰知道如何解決這個問題?
謝謝!
這是否與節點4.x? –
是@BenjaminPasero我正在使用節點4.x –