Debug node js in webstorm

北城以北 提交于 2020-01-16 00:43:35

问题


I spent lot of time to find out how I can debug simple node.js file in webstorm. after writing simple api in node.js I stuck at some place and looking for solution where i can debug line by line. I am using Web-storm editor. I will also contribute if find some way.


回答1:



Steps to Debug Node JS code


  • Open console and type node(it will open node shell).
  • Run process.env
  • Copy the contents of the PATH value
  • Add an environment variable to Webstorm called PATH that uses this value. It will overwrite the default PATH variable that Webstorm gives your app.

How to add environment variable to Webstorm.


  • Click on file name on right top corner.
  • Click on Edit configuration and click Environment Variables.
  • Click on + button and paste value of PATH variable value. enter image description here

Now we are done with setup of debug.

Steps to debug

  • click on debug button on Webstrom (it equal to node filename.js which we run on console). enter image description here

Place break point in code and hit API through browser/POSTMAN.



来源:https://stackoverflow.com/questions/36052447/debug-node-js-in-webstorm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!