node-gyp 无法检测到 Windows SDK,尽管已完全安装了 VS2022 BuildTools
作者: eduardoalcantara创建于 2025年12月4日更新于 2026年9月4日
标签WindowsWaiting For InputMultiple node-gyp versions are installedVisual Studio not found
Problem Description
node-gyp fails to detect Windows SDK when compiling native modules, despite having:
- ✅ Complete Visual Studio 2022 Build Tools installation (~15 GB)
- ✅ All Windows SDK versions installed (both via VS Installer and standalone installer)
- ✅ All required workloads and components installed
- ✅ Physical verification that all files exist on disk
Error Output
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://GitHub.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to useWhat node-gyp Detects vs. Reality
node-gyp reports:
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v143
gyp ERR! find VS - missing any Windows SDKPhysical verification shows everything exists:
C:\Program Files (x86)\Windows Kits\10\
├── Include\10.0.26624.0\ ✅ EXISTS (created 2025-12-04 19:19)
│ ├── um\
│ ├── ucrt\
│ ├── shared\
│ └── winrt\
└── Lib\10.0.26624.0\ ✅ EXISTS (created 2025-12-04 19:19)
├── um\x64\
├── ucrt\x64\
└── [others]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\lib\x64\delayimp.lib
✅ EXISTS (137,570 bytes, created 2025-12-04 15:30)What I've Tried
Time Invested
4 hours 19 minutes across 21 troubleshooting iterations
Installation Attempts
1. Spectre Mitigation Libraries ✅ Resolved initial error
# Installed via Visual Studio Installer > Individual Components
- MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)Result: Fixed MSB8040 error, but revealed next issue
2. Node.js Version Correction ✅ Resolved C++20 requirement
# Downgraded from v25.2.1 to v22.20.0 (as required by VSCode's .nvmrc)
nvm install 22.20.0
nvm use 22.20.0Result: Fixed C++20 error, but revealed DelayImp.lib issue
3.
内容来源: nodejs/node-gyp