I am trying to change the working directory of my Node.js script when it is run from a bin script. I have something like the following:
#!/usr/bin/env node
proce
There is no built-in method for Node to change the CWD of the underlying shell running the Node process.
You can change the current working directory of the Node process through the command process.chdir().
var process = require('process');
process.chdir('../');
When the Node process exists, you will find yourself back in the CWD you started the process in.