Get current location in Node.js

If you need the location of the executed JavaScript file in Node.js, then __dirname will be your choice:
console.log(__dirname); // => /users/doru/dev (example output)
If you're referencing a file when importing/requiring it, it's best to use the dot notation:
// will look into current working directory in utils folder after an api.js file

import api from ('../utils/api')
// will look into up one level directory, in utils folder, after an api.js file
If directly in node, then you must use process.cwd():
process.cwd(); // => /Users/doru/dev (example output)