Skip to content

Node Modules builds on Windows (bcrypt, node sass, etc)

Ruslan Konviser edited this page Jun 24, 2019 · 4 revisions

In order to build some of NodeJS modules, you need to have Windows Build Tools installed on Windows OS.

There are two ways how to do it (select one or another):

  1. npm install --global --production windows-build-tools
  2. Install Choco and run choco install visualcpp-build-tools --version=15.0.26228.20170424 --force --upgrade (previous versions was possible to install using https://chocolatey.org/packages/visualcpp-build-tools/14.0.25420.1)

Next, you may need to add VCTargetsPath environment variable with value C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140 (for older builds) or C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets for new builds using VS 2017 toolset

It is also possible to set VS140COMNTOOLS (e.g. to C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools)

See more information: https://github.com/nodejs/node-gyp#on-windows

Important Note: do NOT forget to close the console and open it again after you installed build tools because it set env vars which apply only after console restart!