8

我尝试使用简单的 node.js 示例 visualstudio 代码提供,但不幸的是,当从 Visual Studio 代码(在 OS X 上)启动节点时,该节点会以一些任意 debug-brk 启动,但调试器附件失败。

当我使用 --debug-brk = 5858 手动运行节点应用程序然后使用附加时,我可以调试我的应用程序。有人遇到同样的问题吗?

PS我从单声道项目页面.pkg安装了单声道

这是我的launch.js:

{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.  
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
    {
        // Name of configuration; appears in the launch configuration drop down menu.
        "name": "Launch app",
        // Type of configuration. Possible values: "node", "mono".
        "type": "node",
        // Workspace relative or absolute path to the program.
        "program": "./bin/www",
        // Automatically stop program after launch.
        "stopOnEntry": true,
        // Command line arguments passed to the program.
        "args": [],
        // 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,
        // Environment variables passed to the program.
        "env": { }
    }, 
    {
        "name": "Attach",
        "type": "node",
        // TCP/IP address. Default is "localhost".
        "address": "localhost",
        // Port to attach to.
        "port": 5858
    }
]

}

4

2 回答 2

2

刚刚遇到了同样的问题......代码找不到Node。

将此行更改为指向您的可执行文件,例如:

"runtimeExecutable": "C:/Program Files/nodejs/node.exe",

享受!

于 2015-05-27T22:27:25.700 回答
0

可能是集群的事情。尝试关闭./bin/www 中的集群,就可以调试了。

于 2015-05-01T01:41:51.893 回答