Switch branches/tags
Nothing to show
Find file Copy path
109 lines (87 sloc) 14.4 KB

Configuring your Windows development environment

Command line console and other useful tools

One of the pain points we hear from users is that the command line console in Windows could use some work. We hear ya, and we're working on it. In the meantime, we want to enable you to have the best experience possible. So here are some links to recommended tools to complement your existing experience.

  • cmd: cmd has had some improvements in Windows 10, so be sure to check it out if you abandoned ship in the past 😃. When you're working with Node.js, chances are you'll be spending a bit more time in the console, so it's well worth brushing up on your CLI commands.
  • PowerShell: PowerShell is a powerful object-oriented shell (as opposed to a text-based shell). It's a bit of a learning curve, but well worth it. It also has a bunch of aliases for commands, like ls, that'll make bash-happy people feel more at home. Here's a good walkthrough of some PowerShell commands from a *nix perspective, and there are many other resources to help you get started.
  • Chocolatey: Chocolatey is the apt-get of Windows. There are also some other alternatives like Ninite which have their own advantages, but Chocolatey is the most commonly used.
  • Git: choco install git.
  • nvm-windows: - there are new versions of Node.js coming out all the time, so it can be annoying to migrate between versions. nvm-windows makes it way easier to switch between various versions.
  • npm-windows-upgrade: npm is shipped with Node.js, and upgrading on Windows often requires manual upgrade steps. npm-windows-upgrade makes this process much easier. Install it by running npm install npm-windows-upgrade -g, and run the command by running npm-windows-upgrade.
  • terminal emulators: cmder and ConEmu.
  • Cygwin: Cygwin can be handy if you're more familiar with bash, or are trying to use a Node app that assumes a *nix environment. Cygwin is a distribution of popular GNU and other open source tools running on Microsoft Windows. The core part is the Cygwin library which provides the POSIX system calls and environment these programs expect.
  • Git for Windows Git for windows provides native versions of the BASH shell and some *nix utilites in addition to the command line git and GUI tool. It is probably the best of shells based on MSYS/MinGW but still supplies ports of older versions of the *nix utilities. Works very well in combination with ConEmu.
  • GitHub Desktop GitHub Desktop (previosuly GitHub for Windows) is primarilarly a GUI but it also includes a version of MSYS/MinGW Bash.
  • Putty: ssh client.
  • WinSCP: free [S]FTP client, also supports SCP and webDAV.
  • Fiddler: a web debugging tool. In general, people use it for the browser-side debugging, but you can also configure it to view server-side requests from Node.js.

🚩 TODO Provide more dev environment options and a PowerShell script to make things easier.

📈 IN PROGRESS We're currently planning the next Windows release, so it's a great time to let us know your biggest command line pain points!

Editors and IDEs

  • Visual Studio Code is a lightweight, cross-platform IDE that offers powerful editing, debugging, and git integration for Node.js development. Several Visual Studio Code extension may be useful for Node.js development:

  • Node.js Tools for Visual Studio is a free, open-source extension that turns Visual Studio into a powerful Node.js IDE: intelligent code completions, advanced debugging and profiling, cloud deployment, unit-testing, REPL window, and more. For more information, check out these walkthrough and overview videos. Note that while Visual Studio can be used as a stand-alone additional IDE 'layer' to a comprehensive commandline based workflow, several Visual Studio extensions may also prove useful:

  • WebStorm is a lightweight yet powerful IDE, perfectly equipped for complex client-side development and server-side development with Node.js. It supports TypeScript 1.6, Flow, ES6, Angular 2, TSLint, npm scripts, and more. For more information, check out

MAX_PATH explanation and workarounds

For the uninitiated, MAX_PATH is a limitation with many Windows tools and APIs that sets the maximum path character length to 260 characters. There are some workarounds involving UNC paths, but unfortunately not all APIs support it, and that's not the default. This can be problematic when working with Node modules because dependencies are often installed in a nested manner.


  • ❤️ Start in a short path (e.g. c:\src)
  • > npm install -g rimraf delete files that exceed max_path
  • > npm dedupe moves duplicate packages to top-level
  • > npm install -g flatten-packages moves all packages to top-level, but can cause versioning issues
  • ❤️ Upgrade to npm@3 which attempts to the make the node_modules folder heirarchy maximally flat.
    • Ships with Node v5
    • Or… > npm install –g npm-windows-upgrade
  • Future:

For additional discussion, please see

Compiling native Addon modules

There are three primary reasons you might be interested in this section:

  • you have an existing C++ library you'd like to take advantage of in your Node.js application
  • you are interested in optimizing the performance of some code by writing it in C++
  • you're running into dreaded node-gyp issues and have no idea what's going on.

Identifying native modules

How do you know if an npm package you want to install is a native module? Look for nan, node-gyp, or node-pre-gyp dependencies.

C++ and Node.js? Tell me more...

Environment setup and configuration:


  • Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools from an elevated PowerShell (run as Administrator).

  • Option 2: Install dependencies and configuration manually

    1. Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" workload) or Visual Studio 2017 Community (using the "Desktop development with C++" workload)
    2. Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7
    3. Launch cmd, npm config set msvs_version 2017

Verify everything's working

Here are a few packages you can try installing to see if your environment is set up properly.

  • bson
  • bufferutil
  • kerberos
  • node-sass
  • sqlite3
  • phantomjs
  • utf-8-validate

Resolving common issues

Errors about... Issue Resolution
Python Python 2.7 is not installed or can't be found
  • Install Python 2.7 and add to PATH
  • Specifiy --python=2.7 during npm install
  • npm config set python 2.7 to set default
Inability to find msbuild, Visual Studio, or VC compiler VC compiler not installed, or environment not properly configured
  • Install VC++ compiler
  • Specify --msvs_version=2015 (or other VS version)
  • npm config set msvs_version 2015 -g
NaN/Node/v8/iojs-related syntax errors Package incompatible with current version of Node.js
  • Upgrade to latest version of package + node.js, and see if issue still exists
  • Search issues and/or file an issue on package repo
Other syntax errors Incompatible with compiler version
  • Upgrade to latest version of package + node.js, and see if issue still exists
  • Search issues and/or file an issue on package repo
Missing command or *.h file Configuration is probably fine, but missing other prerequisites
  • Upgrade to latest version of package
  • Check docs, try to install missing prerequisites, ensure they're accessible in PATH
  • Search for header file or other pre-requisite that's missing, that may provide a clue where it's supposed to come from (e.g. Windows SDK not installed, OpenSSL, etc.)
  • Search issues and/or file an issue on package repository
MSB4019 error Older versions of Visual Studio or C++ Build tools already installed
  • Add or modify the environment variable VCTargetsPath top point at the C++ build tools path. This should be something like C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140 (where 140 corresponds to Visual Studio 2015)
  • Search issues and/or file an issue on package repo
__pfnDliNotifyHook2 redefinition error latest version of npm seems to fix this Run npm -g install npm@next

Deploying native modules

Sometimes, when deploying a native module to production, oftentimes it is not possible to set up the production machine with all the required prerequisites to build the native Addon. Therefore, building locally or on a CI server and deploying node_modules may be the best option assuming there aren't any platform differences between the development and deployment machines.