In short: you cannot. The working directory is limited by the context of the process (and possibly of the child processes, but, of course, not of the parent processes). Therefore, the cdd of your Node process cannot propagate back to your shell process.
The general trick is for your Node application to print the working directory to stdout, and your shell will launch your Node application as follows:
cd "$(node app)"
A simple test case:
// app.js console.log('/tmp');
And if you create an alias / shell function for it, it should be relatively painless.
source share