Skip to content

Windows Installation

Mike Blackstock edited this page Nov 7, 2017 · 59 revisions

This page gives specific instructions on setting up Node-RED in a Microsoft Windows environment. The instructions are specific to Windows 10 but should also work for Windows 7 and Windows Server from 2008R2. It is not advisable to use versions prior to Windows 7 or Windows Server 2008R2 due to lack of current support.

Note: Some of the following instructions mention the "command prompt". Where this is used, it refers to either the Windows cmd or PowerShell terminal shells. It is recommended to use PowerShell on all newer versions of Windows as this gives you access to commands and folder names that are closer to those of Linux/Mac.

Quick Start

1. Install Node.js

DCJ:: Let's just test this on 8.9 LTS and then change wording to be just 8.x LTS - and then remove the notes below

Download the latest 8.x LTS version of Node.js from the official Node.js home page. It will offer you the best version for your system.

Run the downloaded MSI file and accept the defaults. After installation completes, close any open command prompts and re-open to ensure environment variables are picked up.

Once installed, open a command prompt and run the following command to ensure Node.js and npm are installed correctly:

node --version && npm --version

You should receive back output that looks similar to:

v8.9.0
5.5.1

DCJ:: Will the && syntax work if not in Powershell ??

Tested: - actually it seems to work in command prompt - but NOT in powershell - please confirm

2. Install Node.js Windows Build Tools

DCJ:: Do you need to run this bit as admin so need some words about starting command prompt using right click etc DCJ:: Are these tools actually needed for a quickstart ? (as they take ages to install - over 1000 secs !!!)

Many Node.js modules used by Node-RED or installed nodes have binary components that will need compiling before they will work on Windows. To enable npm to compile binaries on the Windows platform, install the windows-build-tools module using the command:

npm install --global --production windows-build-tools

DCJ:: would a quick start user know why they would want this (python line below) ? should it be here ?

If you wish to have the built-in Python v2.7 install exposed for use, use the command:

npm install --global --production --add-python-to-path windows-build-tools

3. Install Node-RED

DCJ:: so you can install with or with admin... Need to specify which - so user doesn't just use the window from the previous step...

Installing Node-RED as a global module adds the command node-red to your system path. Execute the following at the command prompt:

npm install -g --unsafe-perm node-red
Notes:
  • Not all Node.js modules will work under windows, check the install output carefully for any errors.
  • During the install some errors may be reported by the node-gyp command. These are typically non-fatal errors and are related to optional dependencies that require a compiler in order to build them. Node-RED will work without these optional dependencies. If you get fatal errors, firstly check that you installed the windows-build-tools module (in step 2) and that you either restarted or logged out and back in first.

4. Run Node-RED

Once installed, you are ready to run Node-RED.

Alternative Installations on Windows

In this section, we provide you with information on alternative ways to install Node.js and npm for running Node-RED on Windows.

Note: You should not use an administrative (AKA "elevated") command prompt unless specifically instructed to. You will very likely need to be quite familiar with command prompts as you learn about Node-RED and Node.js and it will be worth while reading some of the Microsoft articles on PowerShell. the PowerShell Tutorial and PowerShell One-Liners sites may also be helpful.

Standard installations of Node.js on Windows require local administrator rights. Download the appropriate version from the official Node.js home page. It will offer you the best version. While you can use either 32 bit or 64 bit versions on 64 bit Windows, it is recommended to use the 64bit version of Node. If for some reason, you need a different installation, you can use the Downloads Page.

There are two potentially useful alternatives to installing Node.js with the MSI installer.

  1. Using the Chocolatey package manager

    Chocolatey is a package manager for Windows similar to APT or yum on Linux and brew on the Macintosh platforms. If you are already using Chocolatey, you may want to use this tool to install Node.js (e.g. using the nodejs-lts package). Note however, that many packages have uncertain management and that these packages may use different folder locations than those mentioned above.

  2. Using a Node version manager

    Using a Node.js version manager such as nvm-windows can be very helpful if you are doing Node.js development and need to test against different versions. Keep in mind that you will need to reinstall global packages and may need to re-install local packages when when you switch the version of Node you are using.

Note: Microsoft maintain a parallel version of Node that uses the Microsoft Chakra Core JavaScript engine instead of V8. This is not recommended for Node-RED as it has not been tested.

npm on Windows

When you install Node.js, you are also installing the npm package manager. You may see some Internet instructions that recommend installing later releases of npm than the one that comes with the Node.js release - this is not recommended as it is too easy to later end up with an incompatible version. Node.js releases are very regular and that is sufficient to keep npm updated.

Changing the npm Global File Location

Node.js is installed into the Program Files folder as you would expect. However, if you install a global package using npm -g, it is installed into the %AppData%\npm folder for the current user. This is less than helpful if you are installing on a device with multiple user logins or on a server and installing using an admin login rather than the login of the user that will run Node application.

Note: To see what a folder name like %APPDATA% translates to, you can simply type it into the address bar of the Windows File Explorer. Alternatively, in a command prompt, type the command cd %APPDATA%.

Should you need to change the global file location, use the npm --global config set prefix command from a command prompt to change the location to somewhere accessible by the appropriate users. You will also need to change the global cache location with npm config set cache <new cache location> --global. Finally, change the path to use the new prefix location. You will need to log out or restart after this.

Clone this wiki locally