AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Webstorm node js debugging3/23/2023 ![]() ![]() How to debug ts-node via “Attach to Node.Click button Step over several times and magic happens =). It may not be obvious but the debugging process is slightly different from PHP and you should take attention on await/async constructions which are run asynchronously and they can run not in a normal way. Go to file main.ts, set a breakpoint on line five, click the Debugbutton on the right top, wait for some time while the automatic compilation executing and enjoy debugging process. Run/Debug Configuration for TypeScript file Node parameters options are really important do not forget about them. Open the WebStorm->Preferences dialog, go to menu Languages & Frameworks->Webpack. Make sure that Webpack configuration files detection is enabled. Open the WebStorm->Preferences dialog, go to menu Plugins, tab Installed. WebStorm integrates with Node.js providing assistance in configuring, editing, running, debugging, testing, profiling, and maintaining your applications. It wouldnt be wrong to say that this debugger in itself enough to make a developer. Hit the green Debug button next to the list of configurations on the top right. Install the development/debug plugin on WebStorm Install or make sure that Vue.js plugin is installed. Node.js is a lightweight runtime environment for executing JavaScript outside the browser, for example on the server or in the command line. – Environment variables: NODE_ENV=development WebStorm emerges as a great alternative in this case. – JavaScript file: TypeScript file which you want to debug – Working directory: the path to the root of your project Now you can freely add breakpoints in the gutter (the space just to the left of your code) and debug with Run > Debug (D) Super exciting Fork me on GitHub. – Node parameters: -inspect -require ts-node/register – Node interpreter: the path to your node.exe file It creates new debug configuration for your script, some options can be applied automatically such as an option Node interpreter. In the opened window click the green "+" button ( Add New Configuration) and select Node.js Set break point on third line and go to next step.Ĭlick on Edit Configuration. tsconfig.json for compilation process from TypeScript in native JavaScript, PHPStorm will compile code on the fly.Ĭreate main.ts file and add next code for debug: There are no needs to add special options in. That sounds great but a debugging approach is slightly different from PHP debugging with xDebug. I work with PHPStorm many years, so there were no needs to search another IDE for Node.js, such as PHPStorm has natively support for Node.JS. No one serious project get around without debugging. Some time ago, I’ve started to work with Node.JS and its TypeScript. ![]()
0 Comments
Read More
Leave a Reply. |