nodejs/node · error · Exception
%s is missing - make sure VC++ tools are installed.
Error message
%s is missing - make sure VC++ tools are installed.
What it means
MSVSVersion.SetupScript raises Exception('%s is missing - make sure VC++ tools are installed.') when the resolved vcvarsall/Setup script path returned by _SetupScriptInternal(target_arch) does not exist on disk. gyp needs the Visual Studio environment batch file (e.g. vcvarsall.bat or vsvars32.bat) to set up the compiler for the requested target architecture; if the file isn't there, the toolchain isn't really installed at the recorded VS path.
Source
Thrown at tools/gyp/pylib/gyp/MSVSVersion.py:156
return [vcvarsall, "amd64_x86"]
else:
# Otherwise, the standard x86 compiler. We don't use VC/vcvarsall.bat
# for x86 because vcvarsall calls vcvars32, which it can only find if
# VS??COMNTOOLS is set, which isn't guaranteed.
return [JoinPath(self.path, "Common7", "Tools", "vsvars32.bat")]
elif target_arch == "x64":
arg = "x86_amd64"
# Use the 64-on-64 compiler if we're not using an express edition and
# we're running on a 64bit OS.
if self.short_name[-1] != "e" and is_host_arch_x64:
arg = "amd64"
return [vcvarsall, arg]
def SetupScript(self, target_arch):
script_data = self._SetupScriptInternal(target_arch)
script_path = script_data[0]
if not os.path.exists(script_path):
raise Exception(
"%s is missing - make sure VC++ tools are installed." % script_path
)
return script_data
def _RegistryQueryBase(sysdir, key, value):
"""Use reg.exe to read a particular key.
While ideally we might use the win32 module, we would like gyp to be
python neutral, so for instance cygwin python lacks this module.
Arguments:
sysdir: The system subdirectory to attempt to launch reg.exe from.
key: The registry key to read from.
value: The particular value to read.
Return:
stdout from reg.exe, or None for failure.
"""View on GitHub (pinned to 1b2de5e052)
Solutions
- Install the 'Desktop development with C++' workload (or the standalone Build Tools for VS) including MSVC and the Windows SDK.
- Run the VS Installer and Repair the detected installation.
- Verify the script path printed in the error actually exists; if the registered VS path is stale, re-detect or set GYP_MSVS_VERSION/GYP_MSVS_OVERRIDE_PATH to a real install.
- If using Express, ensure target_arch matches what Express supports (x86 only on older Express).
Example fix
# before: VS installed without C++ workload # -> '%s is missing - make sure VC++ tools are installed.' # after: install the workload via VS Installer CLI # vs_installer.exe modify --installPath <VSPath> --add Microsoft.VisualStudio.Workload.NativeDesktop --quiet
Defensive patterns
Strategy: validation
Validate before calling
import os
vs_version = _GetVisualStudioVersion('auto')
script_path = vs_version.SetupScript(target_arch)[0]
if not os.path.exists(script_path):
raise SystemExit('VC++ setup script missing: %s. Install the C++ workload.' % script_path) Type guard
def setup_script_exists(vs_version, target_arch: str) -> bool:
import os
try:
return os.path.exists(vs_version.SetupScript(target_arch)[0])
except Exception:
return False Try / catch
try:
script = vs_version.SetupScript(target_arch)
except Exception as e:
# prompt to install/repair VS C++ workload
raise SystemExit('%s\nInstall "Desktop development with C++" in the VS Installer.' % e) Prevention
- Install VS with the 'Desktop development with C++' workload (or the standalone Build Tools).
- Run VS Installer Repair when the toolchain path goes missing.
- In CI, pre-validate that vcvarsall.bat exists before invoking gyp.
When it happens
Trigger: Selecting a Visual Studio version whose registry/detected path points to a shell install (e.g. only the IDE, no C++ workload); target_arch 'x64' or 'x86' resolving to vcvarsall.bat under a path where only the Express SKU or BuildTools partial install exists; corrupted VS install.
Common situations: Fresh Windows machine with VS installed but the 'Desktop development with C++' workload unchecked; using VS Code without the full VS Build Tools; PATH/registry pointing at a leftover VS folder after uninstall.
Related errors
- Could not locate Visual Studio installation.
- %s requires any SDK of %s version, but none were found
- Environment variable "%s" required to be set to valid path
- AddFileConfig: file "%s" not in project.
- GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be set t
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/8b58acf4edf62ad5.
Report an issue: GitHub.