Visual Studio代码和debugging模式
我在path/home/***/Downloads/main.js中有一个小的js文件。 这个文件的内容是:
console.log("Hello, world")
我的launch.json文件看起来是这样的:
{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "node", "request": "launch", "program": "${workspaceRoot}/main.js", "stopOnEntry": false, "args": [], "cwd": "/home/matan/Downloads", "preLaunchTask": null, "runtimeExecutable": null, "runtimeArgs": [ "--nolazy" ], "env": { "NODE_ENV": "development" }, "externalConsole": false, "sourceMaps": false, "outDir": null }, { "name": "Attach", "type": "node", "request": "attach", "port": 5858, "address": "localhost", "restart": false, "sourceMaps": false, "outDir": null, "localRoot": "${workspaceRoot}", "remoteRoot": null } ]
}
仍然出现以下错误:
程序“nodejs /home/matan/Downloads/main.js”不是绝对path; 考虑添加'$ {workspaceRoot} /'作为前缀,使其成为绝对的。
你有什么想法我做错了吗?
更改
"cwd": "/home/matan/Downloads"
至
"cwd": "${workspaceRoot}"