node 报错 npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe” 解决方法

在安装Vue项目时遇到npm或yarn报错,提示缺少VisualC++组件VCBuild.exe。解决方法是通过管理员权限运行cmd,安装windows-build-tools。安装后需重新启动命令窗口再执行npminstall。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

node npm 报错 MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe” 解决方法

1、问题展示

npm install 或者 yarn install vue项目时报错:

gyp ERR! MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 M 
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\Aisino\x7\frontend\front\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "D:\\MySoft\\Node\\node.exe" "E:\\Aisino\\x7\\frontend\\front\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\Aisino\x7\frontend\front\node_modules\node-sass
gyp ERR! node -v v14.21.3

2、解决方法

缺少windows构建插件
管理员权限cmd窗口执行以下命令安装

npm install -g --production windows-build-tools

安装时间较长,耐心等待即可
安装完毕后,需要另起命令窗口执行 npm install,才能加载到刚下载的插件

npm ERR! code 1 npm ERR! path D:\flowspace\cldoa-web\node_modules\node-sass npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js npm ERR! Building: D:\tools\nodeJs\node.exe D:\flowspace\cldoa-web\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm ERR! �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�/m�����ء� npm ERR! ��������ʱ��Ϊ 2025/6/11 13:46:08�� npm ERR! �ڵ� 1 �ϵ���Ŀ��D:\flowspace\cldoa-web\node_modules\node-sass\build\binding.sln��(Ĭ��Ŀ��)�� npm ERR! ValidateSolutionConfiguration: npm ERR! �������ɽ���������á�Release|x64���� npm ERR! MSBUILD : error MSB3428: δ�ܼ��� Visual C++ �����VCBuild.exe����Ҫ��������⣬1) ��װ .NET Framework 2.0 SDK��2) ��װ Microsoft Visual Studio 2005���� 3) ������������װ��������λ�ã��뽫��λ�����ӵ�ϵͳ·���С� [D:\flowspace\cldoa-web\node_modules\node-sass\build\binding.sln] npm ERR! �����������Ŀ��D:\flowspace\cldoa-web\node_modules\node-sass\build\binding.sln��(Ĭ��Ŀ��)�IJ ��� - ʧ�ܡ� npm ERR! npm ERR! ����ʧ�ܡ� npm ERR! npm ERR! ��D:\flowspace\cldoa-web\node_modules\node-sass\build\binding.sln��(Ĭ��Ŀ��) (1) -> npm ERR! (_src_\libsass Ŀ��) -> npm ERR! MSBUILD : error MSB3428: δ�ܼ��� Visual C++ �����VCBuild.exe����Ҫ��������⣬1) ��װ .NET Framework 2.0 SDK��2) ��װ Microsoft Visual Studio 2005���� 3) ������������װ��������λ�ã��뽫��λ�����ӵ�ϵͳ·���С� [D:\flowspace\cldoa-web\node_modules\node-sass\build\binding.sln] npm ERR! npm ERR! 0 ������ npm ERR! 1 ������ npm ERR! npm ERR! ����ʱ�� 00:00:06.13 npm ERR! gyp info it worked if it ends with ok npm ERR! gyp verb cli [ npm ERR! gyp verb cli 'D:\\tools\\nodeJs\\node.exe', npm ERR! gyp verb cli 'D:\\flowspace\\cldoa-web\\node_modules\\node-gyp\\bin\\node-gyp.js', npm ERR! gyp verb cli 'rebuild', npm ERR! gyp verb cli '--verbose', npm ERR! gyp verb cli '--libsass_ext=', npm ERR! gyp verb cli '--libsass_cflags=', npm ERR! gyp verb cli '--libsass_ldflags=', npm ERR! gy
最新发布
06-13
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值