Getting up and running with Node.js

So I have been tasked with getting to grips with Node.js for work, and as my background being a C# developer, this shouldn’t be to hard.

This post outlines just the very basics from a tutorial I found on learning node.js, and outlines the environment setup and writing a simple console output of Hello World.

I am now running a Mac as my main workstation, a MacBook Pro – top of the line system (thanks to work – I love my work), and will list out the process I went through to get Node.js running.

  1. Navigated to:
  2. Downloaded the relevant installer, as I am using a Mac now, I will outline what I did Mac wise.  (I downloaded the Mac OS X Installer Package.
  3. Ran the installer and went through the licensing agreement etc…
    Screen Shot 2016-07-12 at 16.25.29   Screen Shot 2016-07-12 at 16.32.07
  4. Install == done!

Now for the Hello Word application in Node.js!

On my Mac I am running NetBeans 8.1, and there is direct support in NetBeans for JavaScript files.  So the main editor I will be using moving forward will be NetBeans rather than Eclipse or any other text editor (I haven’t used Eclipse in a long time so am not ‘not recommending Eclipse’).

Here are the steps I took from the tutorial I did to run the Hello World application:

  1. So my first task was to create a new file named helloworld.js
  2. In the new file write the following code:
    console.log("Hello World");
  3. Next we need to execute the code, and this is done by the following command:node helloworld.js 

    Note.  To get this to work I launched terminal on my Mac and then navigated to the folder where I placed my script and then ran the command in the terminal.

    The output of this should be:

    Hello World