node.js - 尝试在 Windows 10 上的 VS Code 调试中运行“npm run start”
问题描述
通常,我跑来npm run start
运行我的程序。我正在尝试使用 VS Code 调试器在运行程序时对其进行调试。
这是我的 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": [
{
"name": "(Windows) Launch electron",
"type": "cppvsdbg",
"request": "launch",
"program": "npm",
"args": ["run", "start"],
//"preLaunchTask": "build:win32",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true
}
]
}
当我使用 VS Code 运行它时,我得到的错误是:launch program '' does not exist.
如果我在调试会话中使用node
under ,这一切都很好。program
其他事情:
$ which npm
/c/Program Files/nodejs/npm
我尝试更改program
为确切的路径,但没有成功。
解决方案
我认为原因在于您的“程序”字段,它应该定位可执行文件。一些常见的值就像"program": "${workspaceFolder}/app.js"
program - executable or file to run when launching the debugger
推荐阅读
- reactjs - 构造函数中未定义的上下文 - 反应
- javascript - MikroORM 无法在 postgresql://postgres@127.0.0.1:5432 上连接到数据库 lireddit
- python - Pandas For 循环,如果 ColumnA 中存在字符串,则 ColumnB 值 = X
- php - laravel accessor 和 mutator 被用作关系
- scheme - 以下将在方案中显示什么?
- java - 从 DB 中检索 Uri 时 - “无法执行 android:onClick 的非公共方法”,e); 爪哇
- common-lisp - “progv”中“符号值”的行为
- error-handling - 平滑误差的残差
- python - 拆分文件文档并对其进行排序
- r - 如何填充 R 中 plot_ly 中两个子图的中间以绘制为“体积”图?