• This repository has been archived on 11/Sep/2021
  • Stars
    star
    3,379
  • Rank 12,751 (Top 0.3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📦 Install C++ Build Tools for Windows using npm

Windows-Build-Tools

npm version dependencies


Please note that the official Node.js for Windows installer can now automatically install the required tools. That's likely a much better option than the module listed here (windows-build-tools).


On Windows? Want to compile native Node modules? Install the build tools with this one-liner. Start PowerShell as Administrator and run:

npm install --global windows-build-tools

Or, if you are using Yarn:

yarn global add windows-build-tools

Gif

After installation, npm will automatically execute this module, which downloads and installs Visual C++ Build Tools, provided free of charge for most users by Microsoft (as part of Visual Studio Community, please consult the license to determine whether or not you're eligible). These tools are required to compile popular native modules. If not already installed, it will also install Python 3.8, configuring your machine and npm appropriately.

💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1 (Currently not installed automatically by this package)

Both installations are conflict-free, meaning that they do not mess with existing installations of Visual Studio, C++ Build Tools, or Python. If you see anything that indicates otherwise, please file a bug.

Visual Studio 2017 vs Visual Studio 2015

This module is capable of installing either the build tools from Visual Studio 2017 or Visual Studio 2015.

By default, this tool will install the 2017 build tools. To change that, run this script with the --vs2015 parameter.

Usage

npm [--python-mirror=''] [--proxy=''] [--debug] [--strict-ssl] [--resume] [--sockets=5] [--vcc-build-tools-parameters=''] [--vs2015] [--dry-run-only] install --global windows-build-tools

Optional arguments:

  • --offline-installers: Path to a folder with already downloaded installers. See
  • --python-mirror: Use a given mirror to download Python (like --python_mirror=https://npm.taobao.org/mirrors/python/). You can alternatively set a PYTHON_MIRROR environment variable.
  • --proxy: Use a given proxy. You can alternatively set a PROXY environment variable.
  • --debug: Be extra verbose in the logger output. Equal to setting the environment variable DEBUG to *.
  • --strict-ssl: Enables "Strict SSL" mode. Defaults to false.
  • --resume: By default, windows-build-tools will resume aborted downloads. Set to false to disable.
  • --sockets: Specifies the number of http sockets to use at once (this controls concurrency). Defaults to infinity.
  • --vcc-build-tools-parameters: Specifies additional parameters for the Visual C++ Build Tools 2015. See below for more detailed usage instructions.
  • --silent: The script will not output any information.
  • --vs2015: Install the Visual Studio 2015 Build Tools instead of the Visual Studio 2017 ones.
  • --dry-run-only: Don't actually do anything, just print what the script would have done.
  • --include-arm64-tools: Include the optional Visual Studio components required to build binaries for ARM64 Windows. Only available with the 2017 and newer build tools and Node.js v12 and up.

Supplying Parameters to the VCC Build Tools

You can pass additional parameters directly to the VCC Build Tools installer. This tool does not check if the parameters make sense - passing incorrect parameters might break the whole installation.

Supply parameters to windows-build-tools as a JSON array. Here's quick example (note the double quotes):

npm --vcc-build-tools-parameters='[""--allWorkloads""]' install --global windows-build-tools

Visual Studio 2015 Parameters

If you run windows-build-tools with --vs2015, these parameters are available:

  • /AdminFile: Specifies the installation control file.
  • /CreateAdminFile: Specifies the location to create a control file that can then be used
  • /CustomInstallPath: Set Custom install location.
  • /ForceRestart: Always restart the system after installation.
  • /Full: Install all product features.
  • /InstallSelectableItems: <item1;item2;...;itemN> Choose which selectable item(s) to be installed. -selectable item to be installed, just pass in this switch without any value.
  • /Layout: Create a copy of the media in specified folder.
  • /NoRefresh: Prevent setup checking for updates from the internet.
  • /NoRestart: Do not restart during or after installation.
  • /NoWeb: Prevent setup downloading from the internet.
  • /Passive: Display progress but do not wait for user input.
  • /ProductKey: <25-character product key> Set custom product key (no dashes).
  • /PromptRestart: Prompt the user before restarting the system.
  • /Repair: Repair the product.
  • /Uninstall: Uninstall the product.
  • /Uninstall /Force: Uninstall the product and features shared with other products.

Visual Studio 2017 Parameters

The available parameters are documented here.

Offline Installation

By default, windows-build-tools will download the latest installers from Microsoft each time it's installed. Alternatively, you can prepare a folder that contains installers. They need to have their original names:

  • Visual Studio Build Tools: vs_BuildTools.exe or BuildTools_Full.exe
  • Python: python-3.8.1.amd64.msi or python-3.8.1.msi

Then, run windows-build-tools with the --offline-installers argument:

npm install -g windows-build-tools --offline-installers="C:\Users\John\installers"

Support & Help

This package currently only handles the most common use case, none of the edge cases. If you encounter errors, we'd greatly appreciate error reports (and even pull requests). This is currently tested on Windows 10.

Node versions

  • windows-build-tools 4.0 and up require at least Node v8.
  • windows-build-tools 3.0 and up require at least Node v6.
  • windows-build-tools 1.0 and up require at least Node v4.

Where is Python installed?

It's saved under %USERPROFILE%\.windows-build-tools\python38.

Installing as a Non-Administrator

windows-build-tools works best if installed from an account with administrative rights. However, thanks to @brucejo75, the following steps can be taken to install to a different user account:

  1. From your non-admin account (e.g. <Me>) run cmd.exe as administrator.
  2. Set the following environment variables in the new command shell:
set APPDATA=C:\Users\<Me>\AppData\Roaming
npm config set prefix C:\Users\<Me>\AppData\Roaming\npm
set USERNAME=<Me>
set USERPROFILE=C:\Users\<Me>

Ensure that the variables passed match your location of npm's roaming data and the location of user profiles on your machine. For <me>, substitute the name of the account you want to install windows-build-tools for. For more information, see the npm config set prefix description here.

  1. Run npm install -g windows-build-tools

Examples of Modules Supported

In theory, windows-build-tools supports all pure C++ addons for Node.js (and virtually everything else that requires a native compiler toolchain to be installed on your machine).

To ensure that that's true, we take a fresh Windows 10 installation, add windows-build-tools, and ensure that the most popular native Node addons compile from source. Those are: node-sass, bcrypt, sqlite3, serialport, websocket, deasync, grpc, canvas, sharp, hiredis, leveldown, nodegit, zqm, ffi, libxmljs, iconv, ref, sleep, microtime, couchbase, bignum, kerberos, and ursa.

License & Credits

The Python installation was made possible by Ali Hajimirza, who kindly wrestled with Python's MSIs until they surrendered. For details regarding the license agreements applicable to Python, see History and License 3.x.

Use of Microsoft software is subject to the terms of the corresponding license agreements. For details regarding the license agreements applicable to Visual Studio products, refer to their License Directory page. (See also this discussion for the gist of it.)

Copyright (C) 2018 Felix Rieseberg. Licensed MIT. For more details, please see LICENSE. This license applies to this package only, not to its dependencies or the 3rd party software that it installs.

More Repositories

1

windows95

💩🚀 Windows 95 in Electron. Runs on macOS, Linux, and Windows.
TypeScript
22,102
star
2

macintosh.js

🖥 A virtual Apple Macintosh with System 8, running in Electron. I'm sorry.
JavaScript
8,229
star
3

npm-windows-upgrade

🚀 Upgrade npm on Windows
JavaScript
2,539
star
4

windows-development-environment

🔭 Turning Windows into an environment ready for modern development
PowerShell
1,359
star
5

React-Dropzone-Component

📷 ReactJS Dropzone for File Uploads (using Dropzone.js)
JavaScript
1,001
star
6

React-Spreadsheet-Component

📋 Spreadsheet Component for ReactJS
JavaScript
762
star
7

electron-windows-notifications

⚡ Send native Windows WinRT notifications from Electron
JavaScript
260
star
8

slack-archive

Generate static HTML archives of Slack workspaces
TypeScript
213
star
9

project-oxford

🔭 Project Oxford for Node
JavaScript
178
star
10

electron-code-editor

⚡ A tiny code editor based on Electron, in ~100 lines of code
JavaScript
157
star
11

electron-notification-state

🔍 Should you display a notification? Let's find out!
TypeScript
148
star
12

Ghost-Azure

👻 Install Ghost on Azure with a simple click
JavaScript
129
star
13

peer-review-bot

A little bot checking GitHub pull requests for peer reviews
JavaScript
102
star
14

vsc-ember-cli

⚡ Turn Visual Studio Code into an Ember Cli IDE
TypeScript
93
star
15

razer-chroma

🔥 Control your Razer Keyboard, right from Node
C++
91
star
16

electron-uwp-background

⚡ Sample explaining how to use UWP background tasks with Electron apps
C#
82
star
17

Node-Mayhem

💣 Multiplayer HTML5 shooter with Node.js, Socket.io and Melon.js
JavaScript
69
star
18

Ghost-Updater-Azure

👻 Update Ghost on Azure Websites / Azure Web Apps with a few clicks
JavaScript
62
star
19

electron-windows-interactive-notifications

⚡ Respond to interactive notifications on Windows, from Electron
C++
56
star
20

dennard

🔬 Tiny Node cli tool to see a local app's memory footprint, cross-platform
JavaScript
53
star
21

responsive-images-generator

Generate responsive images from Node
JavaScript
52
star
22

macos-notification-state

🔍 This native module checks if the user is active, if the screen is locked, or if "do not disturb" is enabled.
Objective-C++
52
star
23

Reveal-PikeStreet

"Pike Street" Theme for Reveal.js, intended for Microsoft's DX's Open Source Engineers
JavaScript
44
star
24

travis-jekyll-git

Deploy Jekyll pages using Git and Travis CI
Shell
44
star
25

monaco-loader

📦 Load the Monaco editor with a module loader (require, import, etc)
JavaScript
36
star
26

introducing-electron-editor

Code used in the book "Introducing Electron"
JavaScript
36
star
27

JARVIS

Node.js Personal Assistant Prototype
JavaScript
30
star
28

windows-quiet-hours

Checks if Windows 10 quiet hours are active
JavaScript
26
star
29

parse-server-azure

Adapters, tools, and documentation to use Parse-Server with Microsoft Azure
JavaScript
23
star
30

vsc-travis-ci-status

:shipit: Check the status of your Travis CI project from Visual Studio Code
TypeScript
23
star
31

parse-docker

🚤 Run the Open Source Parse Server in Docker
JavaScript
22
star
32

electron-windows-sample

⚡ A minimal Electron sample application showing how to make an Electron app look native on Windows
JavaScript
20
star
33

onedrive-link

Generate direct download links for OneDrive
JavaScript
19
star
34

ember-cli-azure-deploy

🔧 Build Ember Cli Apps on Azure Websites
Shell
19
star
35

electron-comrade

🔧 Run Electron apps with different versions or builds of Electron
TypeScript
18
star
36

parse-server-azure-storage

Use Azure Blob Storage with Parse Server
JavaScript
16
star
37

parse-docker-azure

🐳 Deploy the Open Source Parse Server on Azure, using Docker
15
star
38

iojs-azure

Running io.js on Azure Websites
Shell
15
star
39

emoji-autocomplete

📇 Node Library, turning words into emojis (turn rent into 🏠 💸)
JavaScript
14
star
40

windows-shortcuts-ps

Node.js: Read Windows shortcuts without native dependencies (Windows 7 and up)
JavaScript
14
star
41

windows-active-process

Check which process is currently in the foreground (focused / active)
C++
14
star
42

electron-winstore-auto-launch

🚀 Configure your Electron to start automatically when the user logs in
TypeScript
14
star
43

ember-cli-windows-addon

🚤 Ember Addon, Optimizing Ember Cli Performance on Windows
JavaScript
14
star
44

WinBridge

Native WinRT Controls & Features for Unity3D
C#
14
star
45

MicrosoftBand-Sample

A small sample showcasing interaction with the Microsoft Band
C#
13
star
46

sleuth

🕵️‍♂️ A Slack log viewer
TypeScript
12
star
47

windows-notification-state

SHQueryUserNotificationState, but as a native Node addon
JavaScript
11
star
48

SlackbotBender

A simple chatbot for slack.
JavaScript
10
star
49

medium-stats

You want Medium stats for traffic sources, this tool will give them to you
JavaScript
10
star
50

electron-smorgasbord

📦 A local update server for Squirrel & Electron, with a fancy GUI
TypeScript
10
star
51

lets-encrypt-iis

IIS Configurator for the wonderful Let's Encrypt project
Python
10
star
52

electron-face-detection-windows

Detect Faces in images, using Windows' very own face detection
JavaScript
9
star
53

chrome-cachetool

Chrome & Chromium's "cachetool"
TypeScript
8
star
54

Ghost-Desktop

Ghost for Desktops
JavaScript
7
star
55

azure-node4

Run Node.js 4.0 on Azure
Shell
7
star
56

javascript-course

Solutions to my little JavaScript course's exercises
JavaScript
6
star
57

modernweb

Code Demo for ModernWeb 2018 Keynote
HTML
6
star
58

electron-versions

Get Electron and Chromium versions for tags in a given repository
TypeScript
6
star
59

node-app-nap

😴 Disable macOS App Nap using Node
Objective-C++
5
star
60

electron-test-build

Take a built Electron app, replace the version of Electron
JavaScript
4
star
61

azure-npm3

Use npm3 on Azure Web Apps (formerly known as Azure Websites)
Shell
4
star
62

docker-jekyll

🐳 Jekyll with Extras for Docker
4
star
63

electron-squirrel-s3

Update your Electron app directly from S3
TypeScript
4
star
64

UnityGettingStarted

Code for the TR Unity Presentation
C#
4
star
65

nodesummit-workshop

JavaScript
4
star
66

waffle

JavaScript
4
star
67

shout-azure

🔈 Deploy Shout to Azure
3
star
68

AndroidAzureTweets

A sample Twitter-Style app using Azure Mobile Services for Android
Java
3
star
69

mountaingiantweb

JavaScript
3
star
70

find-npm-windows

📦 Find npm on Windows
JavaScript
3
star
71

dengue-research-portal

💻 A researcher's portal into dengue fever history and machine learning prediction
JavaScript
3
star
72

internet-explorer-version

Find the installed version of Internet Explorer, using Node.js
JavaScript
3
star
73

wrapped

A silly "wrapped" generator for my team
TypeScript
3
star
74

chrome-software-rendering-list

🙅 Chromium's list of blacklisted GPUs, consumable as a Node module
JavaScript
2
star
75

Unity-WinRT-WP8-PlayMovieNatively

Playing a movie on WinRT from within Unity
C#
2
star
76

atom-ghost

Write your blog posts in Atom, publish with Ghost
JavaScript
2
star
77

electron-forge-maker-nsis

An electron-forge maker for NSIS that supports electron-forge v6 and can be used as a replacement for electron-builder. Supports code-signing and basic updates with electron-updater.
TypeScript
2
star
78

slack-wechat-bridge

TypeScript
2
star
79

SmoothRawMouse-UnityWindows8

Smoothened Mouse device delta readings in Unity for Windows 8 Store
C#
2
star
80

DJWindows98

A Mini Stage Show for DJ Windows 98
C#
2
star
81

node12-azure

Run Node 0.12 (Stable) on Azure Websites
Shell
2
star
82

LockLogger

A little debugging tool to log your session status
JavaScript
2
star
83

adfreeclient

Client for AdFree, TechCrunch Disrupt Hackathon Project
CSS
2
star
84

ember-visual-studio

A Visual Studio extension for Ember and Ember Cli
C#
1
star
85

ghost-arm

Ghost for ARM
JavaScript
1
star
86

sailsjs-azure

SailsJS, deployable to Azure
JavaScript
1
star
87

test-windows-linux-subsystem

⚡ We should probably test this Linux thing we just got
Shell
1
star
88

buy-my-vanagon

https://www.1979vanagon.com
HTML
1
star
89

SquirrelCLSIDForAppUserModelId

Quickly see what ToastActivatorCLSID Squirrel would generate for your AppUserModelId
C#
1
star
90

electron-drone

JavaScript
1
star
91

sanitize-xml-string

Sanitize a string for use with XML
TypeScript
1
star
92

npm-config-arguments

Parses npm_config env variables and assigns them to argv - useful for 'npm run' commands
JavaScript
1
star
93

kona

🏃 Kona A Slack Bot for Strava
TypeScript
1
star
94

tile

C++
1
star
95

electron-slack-tutorial

TypeScript
1
star
96

OxideFleet

Oxide, but for Car Management
JavaScript
1
star
97

runtime-logo

A logo for Slack's Desktop Runtime team
JavaScript
1
star
98

electron-react-playground

TypeScript
1
star
99

ember-service-worker-ghost-cache

JavaScript
1
star
100

desktop-stunts-workshop

Files and examples from my workshop "Building Desktop Software & Silly Desktop Stunts"
JavaScript
1
star