Specifying Visual Studio Version in NPM Installs


Sometimes when you install a NPM package, you'll run into an issue like this:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(35,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.

Normally you'll get this if you're only running VS2012 and it wants VS2010/VS2008.  You can ask NPM to use Visual Studio 2012 instead by using with "--msvs_version=2012" command.

Example:

npm install socket.io --msvs_version=2012

Tada.  This should work almost every time.

I really hope you enjoyed this post, and I especially hope you learned something new today because of it.

If you don't mind, I would love to send you more great knowledge packed emails (promise no more than 1 per week!).

Sign up below!

Full Name
Email *
email marketing by activecampaign
comments powered by Disqus