Categories
JavaScript Answers

How to change working directory in my current shell context when running Node.js script?

Spread the love

To change working directory in my current shell context when running Node.js script, we call the process.chdir method.

For instance, we write

const process = require("process");
process.chdir("../");

to call the process.chdir method to go up one directory level.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *