简体   繁体   中英

how to debug a file in node_modules

I'm new to node and am playing around with SailsJS. I found what I think is a bug (reported it), but I wanted to have ago at debuging it myself.

I located the file that I need to investigate in the node_modules folder.

I tried putting a console.log in it to ensure I had the right one. Nothing happened.

So I tried placing log statements in several other files in node_modules that are at the top of the dependency tree. Nothing is printing out.

Do I need to do something to refresh the cache make this work? OR am I going about this in completely the wrong way!

Usually, if you think that an external module has a bug, the best approach is to clone it and write a test that shows which is the offending set of inputs. SailJS is available on GitHub, so you can freely and easily contribute with a merge request if you find that you are right. This way, you can adopt the same approach used by the project to test the code (as an example, using mocha). In case the merge request will be accepted, while waiting for a new release on npm you can refer to your remote copy by means of the package.json file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM