I got some npx create-react-app
command stuck without showing any error on the terminal. So, I require to run npx
in debug mode.
Is there a way to get a debug log for npx commands to identify the issue?
edit: the command I ran:
npx create-react-app my-app
For debugging multiple instances of your application you can launch them separately from the command line (or press Ctrl+F5 in VS to launch the application without debugger attached) and then attach the VS debugger manually using the Debug -> Attach to Process... menu command.
The npm debug package provides a strong and selective debugging method to improve the code and remove console. log statements from the application as it can be used in different files by using it with different keys like myapp:server for server file, myapp:user for user file, etc.
To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.
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:
npx is a very powerful command that's been available in npm starting version 5.2, released in July 2017. If you don't want to install npm, you can install npx as a standalone package npx lets you run code built with Node.js and published through the npm registry.
If you have defined an npm debug script in your package.json, you can use it directly from your launch configuration. Make sure that the debug port used in the npm script, corresponds to the port specified in the snippet. Attach: Attach to the debug port of a locally running Node.js program.
Launch via npm: Launch a Node.js program through an npm 'debug' script. If you have defined an npm debug script in your package.json, you can use it directly from your launch configuration. Make sure that the debug port used in the npm script, corresponds to the port specified in the snippet.
I don't know which argument you can pass to npx
but you can do it with npm run
:
npm -dd run create-react-app my-app
You can find the answer here. you can debug an npx
command providing the --node-options=--inspect
command line argument:
npx --node-options=--inspect create-react-app my-app
Then in Chrome and you will find a NodeJs debugger button at the top of the Developer Tools panel:
Click on it and a new Chrome Developer Tools instance will start with your project loaded in the source code.
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.
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