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
},
]
}