Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable debug for node modules?

Having started to work on node.js recently, I am trying to use rename package. Successfully installed (npm install rename) package and sample code (residing in file test.js) is pasted below:

console.log('Starting to rename');
var rename = require('rename');
rename('a.js', 'b.js');
console.log('Rename done');

The file a.js resides in the same directory as test.js. The console shows the two debug messages correctly, but the file a.js is not renamed.

How can I enable debug on rename module (or for that matter any node module), so that I can debug it additional log messages?

Note: Other packages like find, mkdirp, etc are working fine.

like image 418
contactabbas Avatar asked Mar 19 '15 09:03

contactabbas


1 Answers

You can enable debug by doing a DEBUG=* node app.js or passign env variable DEBUG with wildcard * . It would enable debug for all modules, provided the module you wish to debug is actually using debug. Hardcore way of doing is to make local changes in the module.

like image 106
rohitishere1 Avatar answered Nov 09 '22 07:11

rohitishere1