Run Node.js scripts from the command line

Run Node.js scripts from the command line

The usual way to run a Node.js program is to run the node globally available command (once you install Node.js) and pass the name of the file you want to execute.

If your main Node.js application file is app.js, you can call it by typing:

node app.js

While running the command, make sure you are in the same directory which contains the app.js file.

Edit this page on GitHub