2017-09-13 88 views
0

我們正在建立一個新的OSX機器和得到這個消息試圖啓動和調試基於打字稿節點的應用程序時:無法啓動和調試打字稿使用節點

無法啓動程序「/項目/是/ 0.0.34 /服務器/服務器/ server.ts'; 設置'outDir或outFiles'屬性可能會有所幫助。

我們已經使用相同的啓動配置一年多了,我們不會將輸出寫入單獨的目錄,所以不需要設置'outFiles'。該程序從命令提示符運行良好。但是,試圖在VsCode中啓動應用程序現在返回上述錯誤。我們最近從v7.3.0升級到Node v8.5.0。基於文檔,這應該仍然有效。有關此問題的其他帖子涉及將源代碼(和源代碼映射)寫入不同目錄的問題。

launch.json

{ 
    "configurations": [ 
     { 
      "name": "Launch Program", 
      "type": "node", 
      "request": "launch", 
      "program": "${workspaceRoot}/server/server.ts", 
      "cwd": "${workspaceRoot}" 
     } 
    ] 
} 

這裏的tsconfig:

{ 
    "compilerOptions": { 
     "target": "es5", 
     "module": "commonjs", 
     "sourceMap": true, 
     "watch": true, 
     "allowUnreachableCode": true, 
     "noImplicitUseStrict": true 
    } 
} 

回答

0

的 「outFiles」 設置似乎現在需要使用VsCode節點+打字稿項目。我將它添加到了launch.json中,現在它正在工作。

"outFiles": [ 
    "${workspaceRoot}/**/*.js" 
] 
0

像這樣使用你的launch.json文件。

{ 
// Use IntelliSense to learn about possible attributes. 
// Hover to view descriptions of existing attributes. 
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 
"version": "0.2.0", 
"configurations": [ 

{ 
    "type": "node", 
    "request": "launch", 
    "name": "Launch Program", 
    "program": "${workspaceFolder}/yourjsfile.js" 
}, 
    { 
     "type": "node", 
     "request": "launch", 
     "name": "Launch Program", 
     "program": "${file}", 
     "outFiles": [ 
      "${workspaceFolder}/**/*.js" 
     ] 
    } 
] 
}