From the node manual I see that I can get the directory of a file with __dirname, but from the REPL this seems to be undefined. Is this a misunderstanding on my
__dirname
Though its not the solution to this problem I would like to add it as it may help others.
You should have two underscores before dirname, not one underscore (__dirname not _dirname).
_dirname
NodeJS Docs