When using require, the path is relative to that source file (NOT root directory).

When using fs, the path is relative to process.cwd() (NOT that source file).

The relativity is different, yet should be a good design from the node developers. If you always require a certain file, perhaps put it in node_modules.




Back to Home