安装Node.js v20.13.1时kb2919355依赖问题的解决方法
解决Node.js v20.13.1 LTS安装时Chocolatey依赖错误问题
问题场景
在Windows x64系统安装Node.js v20.13.1 LTS时,勾选了"自动安装必要工具"选项,Node.js本体安装完成后,弹出的PowerShell终端出现以下Chocolatey相关错误:
WARNING: 'choco' was found at 'C:\ProgramData\chocolatey\bin\choco.exe'. WARNING: An existing Chocolatey installation was detected. Installation will not continue. This script will not overwrite existing installations. If there is no Chocolatey installation at 'C:\ProgramData\chocolatey', delete the folder and attempt the installation again. Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself. If the existing installation is not functional or a prior installation did not complete, follow these steps: - Backup the files at the path listed above so you can restore your previous installation if needed. - Remove the existing installation manually. - Rerun this installation script. - Reinstall any packages previously installed, if needed (refer to the lib folder in the backup). Once installation is completed, the backup folder is no longer needed and can be deleted. Chocolatey v2.2.2 Upgrading the following packages: python;visualstudio2019-workload-vctools By upgrading, you accept licenses for the packages. python v3.12.3 is the latest version available based on your source(s). visualstudio2019-workload-vctools is not installed. Installing... [NuGet] One or more unresolved package dependency constraints detected in the Chocolatey lib folder. All dependency constraints must be resolved to add or update packages. If these packages are being updated this message may be ignored, if not the following error(s) may be blocking the current package operation: 'python 3.12.3 constraint: python3 (= 3.12.3)' Unable to resolve dependency 'kb2919355': Unable to find a version of 'kb2919355' that is compatible with 'dotnetfx 4.7.2.20180712 constraint: kb2919355 (>= 1.0.20160915)', 'KB2999226 1.0.20161023 constraint: kb2919355 (>= 1.0.20160915)', 'vcredist140 14.0.23026 constraint: kb2919355 (>= 1.0.20160915)', 'visualstudio2019buildtools 16.0.0 constraint: kb2919355 (>= 1.0.20160915)'. Chocolatey upgraded 0/2 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log). Failures - visualstudio2019-workload-vctools - Unable to resolve dependency 'kb2919355': Unable to find a version of 'kb2919355' that is compatible with 'dotnetfx 4.7.2.20180712 constraint: kb2919355 (>= 1.0.20160915)', 'KB2999226 1.0.20161023 constraint: kb2919355 (>= 1.0.20160915)', 'vcredist140 14.0.23026 constraint: kb2919355 (>= 1.0.20160915)', 'visualstudio2019buildtools 16.0.0 constraint: kb2919355 (>= 1.0.20160915)'.
解决方案
方案1:跳过自动工具安装,手动部署依赖
这是最直接的解决方式,避免Chocolatey的依赖冲突:
- 重新运行Node.js安装包,取消勾选**"自动安装必要工具"**选项,完成Node.js本体安装。
- 手动安装Visual Studio Build Tools 2019:选择"Desktop development with C++"工作负载,确保勾选以下组件:
- MSVC v142 - VS 2019 C++ x64/x86 build tools
- Windows 10 SDK(或对应系统版本的SDK)
- C++ CMake tools for Windows
- 手动安装Python 3.10~3.12版本:安装时勾选"Add Python to PATH",Node.js原生模块编译推荐使用该区间版本。
方案2:修复现有Chocolatey环境
如果需要保留Chocolatey自动安装的方式,尝试以下步骤:
- 以管理员身份打开PowerShell,升级Chocolatey到最新版本:
choco upgrade chocolatey - 强制安装kb2919355补丁(Win10及以上系统可能已集成该补丁,执行后会提示无需安装):
choco install kb2919355 --force - 清理Chocolatey缓存,避免旧依赖文件干扰:
choco cache clean - 重新尝试安装Visual Studio工作负载:
choco install visualstudio2019-workload-vctools --force
方案3:重置Chocolatey环境
若上述方法均无效,彻底重置Chocolatey:
- 备份
C:\ProgramData\chocolatey\lib文件夹(用于恢复已安装的包)。 - 删除
C:\ProgramData\chocolatey整个目录。 - 重新运行Node.js安装包,勾选"自动安装必要工具",让安装器重新部署干净的Chocolatey环境。
内容的提问来源于stack exchange,提问作者Eric Reizas
相关产品推荐
相关产品推荐

