Last Updated: February 25, 2016
·
1.312K
· bptillman

Error running npm install socket.io in Windows

So you're on a Windows machine and trying to create your own node project that uses Socket.io but it keeps throwing errors when doing npm install with a strange message about it not finding Visual Studio 2010, but you have a newer version than that installed?

This is happening because Socket.io has a dependency on node-gyp, which has to compile some C++ files, and it's looking for VS2010 by default.

In the command prompt you previously ran npm install in, just type:

set GYP_MSVS_VERSION=2012

And replace 2012 there with whatever version of VS you have installed, whether that is 2012, 2013, or even 2013 express (by typing in 2013e).

Now run npm install again and everything should work.