You can tell npm to use Visual studio 2010 by doing this...
npm install socket.io --msvs_version=2010
Replace socket.io with the package that is giving the issue.
It is also possible to set the global settings for npm:
npm config set msvs_version 2010 --global
alternatively try npm install --global --production windows-build-tools
npm install --global --production windows-build-tools
Use the PowerShell with administrative rights and run:
npm install --global --production windows-build-tools@4.0.0
after that it will work smoothly.