I am looking for a way to get an exact up-to-date list of all Node.js core modules. Is there an NPM module that supplies such a running list? Somewhere in the annals of my life I had an answer to this question written down, but I don't remember it nor do I remember how good a solution it was.
Node.js has two module systems: CommonJS modules and ECMAScript modules.
On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node. Non-global libraries are installed the node_modules sub folder in the folder you are currently in.
Over 1.3 million packages are available in the main NPM registry.
If you don't mind accessing underscore-prefixed properties, repl exports a _builtinLibs array:
$ node -pe "require('repl')._builtinLibs"
[ 'assert',
'buffer',
'child_process',
'cluster',
'crypto',
'dgram',
'dns',
'domain',
'events',
'fs',
'http',
'https',
'net',
'os',
'path',
'punycode',
'querystring',
'readline',
'stream',
'string_decoder',
'tls',
'tty',
'url',
'util',
'v8',
'vm',
'zlib' ]
That list isn't as "complete" as the list provided by the builtin-modules module in that it does not include undocumented and similar modules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With