Npm package sails hook debug with Webstorm

穿精又带淫゛_ 提交于 2019-12-25 07:47:52

问题


So...
I got this npm package I'm developing for the sails framework.
The NPM package is:

https://github.com/stuk88/ecobill-hook-cms

Its loaded as a hook in sails. what is the best way to debug the package with breakpoints inside Webstorm?


回答1:


Steps:

  1. Go to Run>Edit configurations
  2. Click on (+) and pick Node.js
    1. Select one node interpreter in case is emtpy
    2. set your working directory
    3. Javascript file must be app.js in the same working directory
    4. application parameters (I usually set --dev)
    5. Environment Variables (whatever you want there)
  3. Save (Ok button)
  4. Set some breakpoints within your modules
  5. In the left top corner, just pick your configuration and click on the Debug icon.

That's all. It works for me.

Webstorm: 2016.3.1




回答2:


Ok
So the answer to that is to git clone the hook project to some other folder, and then link that folder to a folder insides /api/hooks/%hook_name%

To make a link in Windows 10, use this command (In Admin CMD): mklink /d c:\target c:\source (Not shure about the attributes order, check it out in --help)

Then the debugging will work like a charm.



来源:https://stackoverflow.com/questions/41838554/npm-package-sails-hook-debug-with-webstorm

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