Although an increasing number of large companies are greenlighting API projects that leverage Node.js, most installation guides for Node are written with the assumption that the engineer is developing on a Mac and deploying to a Linux machine. For engineers who by choice or because of corporate policy use Windows as their development environment, here’s a quick tutorial that walks you through the installation of Node, StrongLoop tools and their required dependencies you aren’t likely to find on a typical Windows machine.
Step 1: Install Python
Python 2.7 (not 3.x or 2.6.x or before) is required by npm to install packages with compiled addons (like strong-agent or websocket support).
- Go to python.org and download the latest stable 2.7.x Windows MSI Installer, either x86 or x86-64, whichever is appropriate for your system.
- Run the installer and make sure to add Python to your PATH
- Accept default “Install for all users”
- Accept default “c:\Python27” for Python files
- Enable non-default “Add python.exe to Path”
Step 2: Install Git
Git is required by npm to download packages from GitHub. Such packages are rare, but exist and installing git will allow them to be installed.
- Go to git-scm.com and select the download for Windows (currently this is version 1.9.4)
- Run the installer
- Accept default install location
- Accept or modify Components
- Accept start menu folder
- Modify “Adjusting your PATH environment” to “Use Git from Windows Command Prompt”
- Accept default “Configuring the line ending conversions”
Step 3: Install Visual Studio
Visual Studio 2012 or later is required by npm to install packages with compiled addons. Please note that gcc, mingw, cygwin, and other ports of non-Microsoft compilers to Windows are not supported by Node.
If you are currently running Windows 7 and 8, use Microsoft Visual Studio C++ 2013 for Windows Desktop (Express). Visual Studio Express is free and more than adequate to support Node.
- Download Visual Studio
- Select “Download” and then “wdexpress_full.exe”…if the download doesn’t start, select the “click here” link, then on the next download page, select the “click here” link beside “wdexpress_full.exe”.
- Run the installer and accept the default location. This is a big installation and can take a long time, so this might be a good time to go grab some lunch!
Step 4: Install Node
Go to nodejs.org, download and install the latest “Windows Installer (.msi)” appropriate for your system.
Step 5: Install StrongLoop
After installing the above tools restart your machine to make sure your new configurations have taken effect.
- Open up a Windows command shell
npm install -g strongloop…Please note that warnings related to the installation of node-syslog can be ignored, they are expected on Windows.
slc -v…you should see a listing of the StrongLoop components and their versions.
Congratulations, you now have Node.js, StrongLoop and its dependencies installed! You are ready to Get Started!
If you encounter any difficulties installing StrongLoop try some of the tips below.
1. Restart Windows, to ensure configuration has taken effect.
2. Verify dependencies are installed:
python --version: should be 2.7.x
node --versionshould be v0.10.x or v0.12.x (Once it is released)
npm --versionshould be 1.x or 2.x (Once Node v0.12 is released)
3. Ensure a simple npm package can be installed:
npm install -g semver
semver --helpshould print usage message
4. Ensure a simple Node compiled addon can be installed:
npm install -g buffertoolsshould compile and install without errors.
If you are still having issues, please report the result to email@example.com. If it was
npm install that failed, please attach the
npm-debug.log file left by npm.
Tips and Tricks
1. If you have multiple versions of python installed, you can select which on is used by npm for building compiled addons:
npm config set python c:/Python2.7/python
2. If you have multiple versions of Microsoft Visual Studio installed, you can select which one is used by npm for building compiled addons:
--msvs_version=2013(as appropriate) to the end of npm install commands, for example:
npm install -g strongloop --msvs_version=2012
- Ready to develop APIs in Node.js and get them connected to your data? Check out the Node.js LoopBack framework. We’ve made it easy to get started either locally or on your favorite cloud, with a simple npm install.