Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 当我使用npm run all时,如何使用VSCode调试Electron Main和渲染器?_Node.js_Json_Npm_Visual Studio Code_Electron - Fatal编程技术网

Node.js 当我使用npm run all时,如何使用VSCode调试Electron Main和渲染器?

Node.js 当我使用npm run all时,如何使用VSCode调试Electron Main和渲染器?,node.js,json,npm,visual-studio-code,electron,Node.js,Json,Npm,Visual Studio Code,Electron,我使用npm run all运行npm start和npm electron.并希望启用VSCode调试,但不确定如何写入启动设置 目前,我有以下设置,但只获得 C:\Program Files\nodejs\npm.cmd dev--inspect brk=32367 当我开始调试时 如何将调试器附加到electron进程 package.json { ... "homepage" : "./", "main": "src/main.js", ... "scripts":

我使用
npm run all
运行
npm start
npm electron.
并希望启用VSCode调试,但不确定如何写入启动设置

目前,我有以下设置,但只获得
C:\Program Files\nodejs\npm.cmd dev--inspect brk=32367

当我开始调试时

如何将调试器附加到electron进程

package.json

{
  ...
  "homepage" : "./",
  "main": "src/main.js",
  ...
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "electron": "electron .",
    "dev": "npm-run-all --parallel electron start"
  },
  ...
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch via NPM",
            "env": {
                "NODE_ENV": "development"
            },
            "windows": {
                "runtimeExecutable": "npm"
            },
            "runtimeArgs": [
                "dev"
            ]
        }
    ]
}
launch.json

{
  ...
  "homepage" : "./",
  "main": "src/main.js",
  ...
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "electron": "electron .",
    "dev": "npm-run-all --parallel electron start"
  },
  ...
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch via NPM",
            "env": {
                "NODE_ENV": "development"
            },
            "windows": {
                "runtimeExecutable": "npm"
            },
            "runtimeArgs": [
                "dev"
            ]
        }
    ]
}

我没有为VSCode添加chrome调试器扩展。
它现在正在使用此设置,使用
runscript
args

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch via NPM",
            "cwd": "${workspaceRoot}",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run-script",
                "dev"
            ],
            "port": 9229
        },
    ]
}