Change working directory in my current shell context when running Node script
问题 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 process.chdir('/Users') When I then run this file with ./bin/nodefile , it exits, but the working directory of the current shell context has not changed. I have also tried shelljs, but that does not work either. What is the best way to do this? I understand it's working but it's just in a separate process. 回答1: The correct way to change