Debug yoman with visual studio code "cannot start the program ..."

I try to debug the yoma generator in the studio visual code, but it keeps telling me that it is cannot launch programm d:\repos\generator\node_modules\.bin\yo'; enabling source maps might helpevery time I press F5

My VS Code config The file is as follows:

{
    "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
        }
    ]
}

And my .json package is something like this:

{
    "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"
    }
}

The path is correct, and the yeomen works, because when I copy it on the command line, Yoman welcomes me and asks which generator I would like to run. In addition, the generator works fine if I select it.

  • VS code version 0.9.2
  • OS is Windows 8.1
  • Yeoman ist latest

What am I missing here?

, , .js y VS, VS (, , , , ) - , program 'd:\foo\bar\yo' does not exist

+4
2

Visual Studio ( 1.16.1) Node.js Yeoman " ".

enter image description here

. , cli.js yo/lib. , Yeoman.

, ("console": "integratedTerminal")

+2

Yeoman Visual Studio cli.js yo.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "node",
            "request": "launch",
            "program": "<global path to yo>/node_modules/yo/lib/cli.js",
            "stopOnEntry": false,
            "args": [
                "yourGeneratorName"
            ],
            "cwd": "${workspaceRoot}",
            "preLaunchTask": null,
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "externalConsole": false,
            "sourceMaps": false,
            "outDir": null
        }
    ]
}

. , , Visual Studio

node --debug "\npm\ node_modules\yo\lib\cli.js" yourGeneratorName

launch.json ,

{
            "name": "Attach",
            "type": "node",
            "request": "attach",
            "port": 5858,
            "address": "localhost",
            "restart": false,
            "sourceMaps": false,
            "outDir": null,
            "localRoot": "${workspaceRoot}",
            "remoteRoot": null
        }

debugger; , .

+3

Source: https://habr.com/ru/post/1613516/


All Articles