Run Node

Now its time to start using Node. First you can simply experiment running Node as a command-line interface (CLI). For that you need only to call the run Node executable with no arguments like this:

$ node

This will start the CLI, which will then wait for you to input an expression. Just to test the installation and see Node actually doing something, you can type:

> console.log(‘Hello World!’);

Hello World!

> undefined


You can also run a JavaScript script from a file. For instance, if you create a file with this content:

console.log(‘Hello World!’);

Name the file helloworld.js . Then run the file by passing the file path as first argument to the Node executable while inside a shell prompt. For example:

$ node hello_world.js

Hello World!




My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Node.Js Tagged with: