After installation of nodejs where can I find the core modules themselves? What is the path to them on my Linux machine? For example I want to see where is the fs module.
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.
The directory node_modules/.bin is where the binaries of the modules used by your project are stored, normally using symbolic links to the respective binaries in the corresponding module's directory.
They are compiled into the executable, but their source can be found here.
EDIT: I'm not intimately familiar with Node's building process, but from what I understand (mostly from this) is that all files in the abovementioned directory are "converted" to C++ using tools/js2c.py
and the results are written to an intermediate file node_javascript.cc
during the building process.
I assume that they hook somewhere into the module/bindings system of Node so that when you use, for instance, require('fs')
, Node will look in its internal list of modules first.
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