【发布时间】:2015-10-28 15:50:19
【问题描述】:
我正在尝试在 Visual Studio 代码中调试一个 yeoman 生成器,但它一直告诉我它 cannot launch programm d:\repos\generator\node_modules\.bin\yo'; enabling source maps might help 每次我按 F5 时
我的 VS Code 配置文件如下所示:
{
"version": "0.1.0",
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch app/index.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "node_modules/.bin/yo",
// Command line arguments passed to the program.
"args": [ "design" ],
// 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": false,
// If JavaScript source maps are enabled, the generated code is expected in this directory.
"outDir": null
}
]
}
我的 package.json 是这样的:
{
"name": "generator-design",
"version": "0.1.0",
"main": "app/index.js",
"files": [
"generators/app"
],
"dependencies": {
"yeoman-generator": "^0.20.3",
"yosay": "^1.0.5",
"chalk": "^1.1.1",
"uuid": "^2.0.1",
"yeoman-option-or-prompt": "^1.0.2"
}
}
路径正确并且 yeoman 正在工作,因为当我将其复制到命令行时,yeoman 会向我打招呼并询问我要运行哪个生成器。如果我选择它,生成器也可以正常工作。
- VS 代码版本为
0.9.2 - 操作系统是 Windows
8.1 - 约曼主义者
latest
我在这里错过了什么?
不确定这是否相关,但是当我将 .js 添加到 yo 文件时,VS Code 会启动控制台(当然它会失败,但至少控制台会启动)
如果我指向错误的路径,错误消息将更改为program 'd:\foo\bar\yo' does not exist
【问题讨论】:
-
像这样调试生成器例如:stackoverflow.com/a/25911430/5476434 - 只是不在 VS Code 中
标签: debugging yeoman visual-studio-code