【发布时间】:2019-05-30 00:36:55
【问题描述】:
通常,我运行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.
如果我在program 下使用node 进行调试会话,这一切都很好。
其他:
$ which npm
/c/Program Files/nodejs/npm
我尝试将 program 更改为该路径,但没有成功。
【问题讨论】:
-
我根据
which命令假设您已将 VSCode 配置为使用 WSL 作为集成终端? -
不,使用 git-bash
-
等等,你在 VSCode 中使用 git-bash?
-
我在 hyper 中运行 which 以找出 npm 的位置,因为它将由 cmd/powershell 通过 vs code 执行。我只是好奇它在 Windows 系统上的位置。它不是由 vs code 运行的。
-
这个错误出现在哪里?您能否发布错误出现在 VSCode 窗口上的屏幕截图?
标签: node.js npm visual-studio-code