I need to launch a particular .js file for execution, in this way:
npx app.js launch.conf.js
//for execution of scripts
npx app.js debug.conf.js
//for debugging the scripts
In my debug.conf.js contains
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. but when I need to debug using the VS code Editor:this is present in my launch.json file:
"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?
The term 'npx' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
You can find the answer here. you can debug an npx command providing the --node-arg=--inspect command line argument: Then in Chrome and you will find a NodeJs debugger button at the top of the Developer Tools panel:
Search the file you need to debug (either in the tree view or using the quick search Cmd/Ctrl-O feature) and place a breakpoint in the Developer Tools editor. Then restart the npx command and start troubleshooting the create-react-app module.
It means that your machine can't execute npx command for some reason. You have an old version of the NPM that doesn't contain npx at all. You can check this using npm -v command Paths are not set up correctly (It looks like you are using Windows machine).
Create a launch.json file (e.g. type Node.js on environment bar) or click the cog at the top for other options .vscode/launch.json opens up or locate and open it (from project's root folder) Paste this in the configurations array, adjust according to your parameters/arguments and save the file:
https://webdriver.io/docs/debugging provides details on how to run in VS code (thank you Mike (comment)):
Go to Run and Debug tab/blade (Ctrl + Shift + D)
Create a launch.json file (e.g. type Node.js on environment bar) or click the cog at the top for other options
.vscode/launch.json opens up or locate and open it (from project's root folder)
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 (e.g. "run select spec") from the top left dropdown/select menu (or press F5 if already selected).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With