Asked 7 years ago
18 Jan 2017
Views 1320
jaydeep

jaydeep posted

how to get list of installed module of Node JS ?

How to get installed module list in Node JS ?
Rasi

Rasi
answered Nov 30 '-1 00:00

process.binding('natives') give you all the builtin module object list , and each module name is key for that object .


console.log(Object.keys(process.binding('natives')).sort());


give all key of the module object list.

lets store it to json file

 var fs = require("fs");
 var builtinModules=Object.keys(process.binding('natives')).sort();
fs.writeFileSync('builtin-modules-list.json', JSON.stringify(builtinModules, null, '\t') + '\n');


it will save builtin-modules-list.json file with all builtin modules in json format
noob

noob
answered Nov 30 '-1 00:00

 
console.log(process.versions.modules);//48
 


process.versions.modules give the total module count . suppose it return 48 means 48 module installed
process.versions.modules indicates the current ABI version, which is increased whenever a C++ API changes. process.versions.modules dont give module counts.LOL - Rasi  
Jan 18 '17 03:12
Post Answer