It turned out to be the file path of the file that was the problem. When running the server using node the working directory is the same as the server.js file thus node.js manages to find the file.
When starting whilst using nohup or just starting with forever the working directory doesn't seem to be the same as server.js.
I solved this by prepending the global variable __dirname
to the filename.