Nodejs: Change working directory when running node bin script

Posted by user2433617 on Stack Overflow See other posts from Stack Overflow or by user2433617
Published on 2013-11-06T03:50:03Z Indexed on 2013/11/06 3:53 UTC
Read the original article Hit count: 141

Filed under:
|
|
|

I am trying to change the working directory when my nodejs script is run from a bin script.

So simplified I have something like:

#!/usr/bin/env node

process.cd('/Users')

When I then run this command like ./bin/nodefile it exits but stays in the same directory it started in.

I have also tried shelljs,

What is the best way to do this? I understand it's working but it's just in a separate process.

Thanks.

© Stack Overflow or respective owner

Related posts about node.js

Related posts about terminal