[英]Unable to launch Debugging for a "npx" launched App in visual studio code
I need to launch a particular .js file for execution, in this way:我需要以这种方式启动一个特定的 .js 文件来执行:
npx app.js launch.conf.js
//for execution of scripts npx app.js launch.conf.js
//用于执行脚本
npx app.js debug.conf.js
//for debugging the scripts npx app.js debug.conf.js
//用于调试脚本
In my debug.conf.js contains在我的 debug.conf.js 中包含
const config = {
debug: true,
execArgv: ['--inspect-brk'],
maxInstances: 1,
cucumberOpts: {
timeout: 30 * 1000 * 4,
},
};
exports.config =config
, When I Execute the 2nd command via CMD I'm able to debug using chromedev Tools debugger. , 当我通过 CMD 执行第二个命令时,我可以使用 chromedev 工具调试器进行调试。 but when I need to debug using the VS code Editor:this is present in my launch.json file:
但是当我需要使用 VS 代码编辑器进行调试时:这出现在我的 launch.json 文件中:
"type": "node",
"name": "manager",
"request": "launch",
"protocol": "auto",
// "port": 5859,
"program": "${workspaceRoot}\\node_modules\\cdem\\bin\\app",
"execArgv": ["--inspect-brk"],
"args": [
"run wdio.debug.conf.js"
]
I keep getting the console op as: debugger attached, waiting for debugger to disconnect and the execution is not launched.我一直将控制台操作设为:附加调试器,等待调试器断开连接并且未启动执行。
Can someone let me how to debug this app using VS Code?有人可以让我如何使用 VS Code 调试此应用程序吗?
https://webdriver.io/docs/debugging provides details on how to run in VS code ( thank you Mike (comment) ): https://webdriver.io/docs/debugging提供了有关如何在 VS 代码中运行的详细信息( 谢谢 Mike(评论) ):
Go to Run and Debug tab/blade ( Ctrl + Shift + D )转到运行和调试选项卡/刀片( Ctrl + Shift + D )
Create a launch.json file (eg type Node.js on environment bar) or click the cog at the top for other options创建一个 launch.json 文件(例如在环境栏上输入Node.js )或单击顶部的齿轮以获取其他选项
.vscode/launch.json opens up or locate and open it (from project's root folder) .vscode/launch.json打开或定位并打开它(从项目的根文件夹)
Paste this in the configurations array, adjust according to your parameters/arguments and save the file:将此粘贴到配置数组中,根据您的参数/参数进行调整并保存文件:
{ "name": "run select spec", "type": "node", "request": "launch", // To run all spec files remove "--spec", "${file}" from below "args": ["wdio.conf.js", "--spec", "${file}"], "cwd": "${workspaceFolder}", "autoAttachChildProcesses": true, "program": "${workspaceRoot}/node_modules/@wdio/cli/bin/wdio.js", "console": "integratedTerminal", "skipFiles": [ "${workspaceFolder}/node_modules/**/*.js", "${workspaceFolder}/lib/**/*.js", "<node_internals>/**/*.js" ] },
Run the above by choosing this configuration (eg "run select spec") from the top left dropdown/select menu (or press F5 if already selected).通过从左上角的下拉菜单/选择菜单中选择此配置(例如“运行选择规范”)来运行上述操作(如果已选择,请按F5 )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.