As pointed out in other answers, node -webkit starts the node process with the wrong "current working directory" (in any case, from the point of view of the command line).
As stated elsewhere, process.env.PWD actually contains what we want (when the application starts from the command line). A simple workaround could be to do the following in your index.html (or elsewhere that is done earlier):
<script type="text/javascript"> if(process.env.PWD) { process.chdir(process.env.PWD); } </script>
Presto! Now process.cwd () returns the right thing.
Apparently, this trick really only works for applications running from the command line, but again, it is probably only necessary when the application is launched from the command line.
There is a ticket for this problem, but old and dusty
source share