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.
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.
-
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
- Visual C++ Build Environment:
- Option 1: Install Visual C++ Build Tools using the Default Install option.
- Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.
- Visual C++ Build Environment:
💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1
- Install Python 2.7 (
v3.x.x
is not supported), and runnpm config set python python2.7
- Launch cmd,
npm config set msvs_version 2015
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