问题
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:
- Go to Run>Edit configurations
- Click on (+) and pick Node.js
- Select one node interpreter in case is emtpy
- set your working directory
- Javascript file must be
app.js
in the same working directory - application parameters (I usually set
--dev
) - Environment Variables (whatever you want there)
- Save (Ok button)
- Set some breakpoints within your modules
- 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