Setting up a local NodeJS Development Environment


This guide will walk you through how to setup a local development environment for NodeJS, the process to get setup is pretty simple and is just a matter of installing the NodeJS tools.

The NodeJS installer comes with npm (Node Package Manager) included, so there's no extra setup to get this running, once node is installed you will be able to use npm as normal to install any libraries.


How to setup a local NodeJS development environment

  1. Navigate to nodejs.org
  2. You should see two download options, you can choose the latest release which might have some new features, or you can choose the LTS version which is known to be stable and had plenty of testing.
  3. You can choose either option, I will choose the LTS option as I know that it is a stable version of the software.
  4. An executable file will be downloaded, run this file to install NodeJS and follow the prompts to install.
  5. You may optionally install additional tools to support native modules, if you're not sure whether you need this, or if you skipped this section, you can always install the additional tools from the start menu in the NodeJS folder.



Check if NodeJS is installed correctly


  1. NodeJS automatically sets the environment variables in Windows so that you don't have to, after installing, you can check whether the installation works by opening Command Prompt and typing in node, you should see something like the following:
  2. If you don't see the above, you may want to check your environment variables are set correctly, I will cover this in the next section.
  3. Test that NodeJS is working by executing some code, after typing node in command prompt, type the following code:
    Console.log("Hello World");

     

  4. If you see "Hello World" printed to the console then you have successfully installed and have a working NodeJS installation.


Setting NodeJS Environment Variables

If you can't execute the NodeJS command from Command Prompt then you might not have your environment variables set, usually this is done by the installer for you but just in case you need to check it, here's the process.

  1. Identify the installation path for NodeJS, you would have specified this in the installation process, usually its defaulted to C:\Program Files\nodejs
  2. Open the Start menu and search for "Environment" you should see the following, click "Edit the system environment variables"
  3. In the window that appears, click the "Environment Variables" button at the bottom.
  4. Select Path under system variables, then click Edit
  5. Then click "New" and paste in the path to your NodeJS installation
  6. Click "OK" to any remaining dialogs.
  7. You will need to close any open Command Prompt instances and open a fresh Command Prompt instance for the change to take effect.

Now you have a local NodeJS installation on your local PC perfect for developing your scripts.

Was this helpful?

Yes No


Comments