Node: How to get the dirname where a script was called from?
command-line, directory, node.js
Solution
What you want is `process.cwd()`, which returns the current working directory of the Node.js process.
Problem
Say I run a Node script from `/foo/bar`, though the script itself is located somewhere else (e.g. `node_modules`). Is there a way to get the working directory where the script was called from, i.e. `/foo/bar`?