Published on

[Solved] MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".

Problem:

Running into the following error when trying to run npm install in a React application:

npm ERR! MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
To fix this,
1) install the .NET Framework 2.0 SDK,
2) install Microsoft Visual Studio 2005 or 3)
add the location of the component to the system path if it is installed elsewhere.
[..\node_modules\node-sass\build\binding.sln]

Solution:

This error has failed to be resolved after trying the well known solution of running the following commands on an Administrator Windows PowerShell instance:

npm install -g node-gyp
npm install --global --production windows-build-tools
Windows PowerShell frozen after running the above commands

Figure 1: PowerShell freezes after running the above commands

Due to PowerShell freezing after running the above commands, I abandoned trying to run npm install on a Windows OS altogether.

Instead, I transferred over the application to a Ubuntu VM instance and was able to run npm install with no issues. So try creating a Linux VM and porting over your codebase onto it. Then run npm install and see if it works.

While this method does not directly solve the error on Windows, I believe it is the quickest and most pragmatic workaround if you don't mind working in a Linux environment.

Conclusion

Thanks for reading this blog post!

If you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.

If you found this article helpful please share it and make sure to follow me on Twitter and GitHub, connect with me on LinkedIn and subscribe to my YouTube channel.