text:
Windows users are not happy.

It all started with this conversation.
As I said, I'm pretty much a newbie and I don't even know what node-gyp does, but what I DO know is that it's a pain to run Windows and install a project with node-gyp as a dependency.
Some numbers:

403 questions on stackoverflow (node-gyp windows)
224 issues mentioning "windows"

It's bizarre that a nodejs developer needs to install visual studio (even the express edition) in order to be able to work on Windows. Even more bizarre is that I, as a .NET developer with full visual studio installed in my machine still can't download a bunch of projects that use this project.
With that being said, I'd like to know from all of you what should we do to make windows users fall in the pit of success? What are the alternatives? Does Microsoft can solve this in any way?

+1
Is there some common effort we can do?
The reliance on both Visual Studio (or the Windows SDK) and Python is such a pain. And when it still doesn't work 99.9/100 times anyway, while node-gyp still being so heavily used by the Node community, it's enough to make a grown man cry or give up on using whatever it was that relied on node-gyp.

+1 this a world of pain, took me hours to install a project with node_gyp

+1 after 8+ hours of trying, still can't use anything that relies on node-gyp.

:+1: after multiple days trying to get this to install I am still fighting VS errors!! It just never gives up.
Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript.

@TooTallNate any thoughts?

node-gyp (just released) has an updated gyp version that adds support for MSVS 2015, and should hopefully ease of lot of this pain for Windows users.

Additionally, you guys should probably support my current effort in bringing FFI into node core, thus eliminating node-gyp from the equation for the majority of use-cases.

Awesome @TooTallNate. I don't have the skills to understand and support your argument, but I can give you a :+1: haha :(
Congratz on the new release, but I believe we have to wait for everyone to update the dependency version and that maybe never happens.

I'm also struggling with this quite a bit.  I'm trying to follow along with this guide (https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup), but I'm not having much luck.
The guide in the wiki directs us to http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express, which redirects to https://www.visualstudio.com/downloads/download-visual-studio-vs#d-2010-express and that page does not offer VS 2010 for download (it's exclusively 2013).
Even more hilarious / sad, in attempting the uninstall procedures, I somehow wound up with "Microsoft Visual Studio 2010 Service Pack 1" listed in my Programs and Features (Uninstall menu), but when I click "Uninstall/Change", I'm given an error after a while that says "A compatible version of Visual Studio 2010 was not detected on the system. This update is designed for only the Microsoft Visual Studio 2010."

Yeah. There needs to be a better way

@TooTallNate I'm pretty sure you're doing the best work there is for Node support on Windows :+1: :) Could I make a request that we update the wiki page (or add a new wiki page) describing the steps for VS 2015 ?

FYI: npm i c3 still fails. Even with vs2015 installed. @TooTallNate any ideas?

c:\git\rr\MyProject\src (master)
? npm i -S c3 --msvs_version=2013
npm WARN package.json package@0.0.0 No description
npm WARN package.json package@0.0.0 No repository field.
npm WARN package.json package@0.0.0 No README data
npm WARN package.json package@0.0.0 No license field.
\

> contextify@0.1.14 install c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify
> node-gyp rebuild

|
c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify {git}
{lamb} if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v120 (Pla
tform Toolset = 'v120') cannot be found. To build using the v120 build tools, please install v120 build tools.  Alternatively, you may up
grade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution
". [c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify\build\contextify.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "-S" "c3" "--msvs_version=2013"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE

npm ERR! contextify@0.1.14 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.14 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\git\rr\MyProject\src\npm-debug.log

I just found out about the environment variable (GYP_MSVS_VERSION ) option here: https://github.com/TooTallNate/node-gyp/issues/339#issuecomment-111011412 , it might help @luisrudge or others.   Any other updated happy paths for Windows users? /cc @TooTallNate @isaacs

+1 This is a real pain point - I'm as much time fiddling around with VS and node-gyp as I am coding at the moment.

+1000
More than two days working to figure out this gyp thing. The problem is I can't give up.

+100500!
Much pain with 'node-gyp'! 15 GB of Visual Studio versions/SP/tools downloaded...
For windows 7 I use VS 2010 and SDK 7.1 command prompt. This instructions can help:
https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/
With Windows 8.1 pro and VS 2013 Express and SDK 8.1 I'm still get this error:
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Не удается открыть файл включение:
v8.h: No such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_module s\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_module s\engine.io-client\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcx proj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.1.0
npm WARN optional dep failed, continuing bufferutil@1.1.0

Now I'm downloading VS 2013 Community (https://github.com/TooTallNate/node-gyp/issues/644)

@Sogl
I installed socket.io with MSVS version set and then installed the rest of the stuff:
npm install socket.io --msvs_version=2015
npm install

Note: I had Visual Studio 2015

I hope this helps if not you can look @ socket.io / issues.

@baazoo
Can't install with 2013/2010:
C:\Users\Артем>npm install -g socket.io --msvs_version=2013

> bufferutil@1.1.0 install C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil
> node-gyp rebuild

C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modules\bufferuti
l>if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-
gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  reb
uild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, до
бавьте параметр "/m".
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Cannot open include file: 'v8.h': N
o such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modul
es\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modu
les\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No description
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No repository field.
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No README data
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "install" "-g" "socket.io" "--msvs_version=2013"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Артем\npm-debug.log

C:\Users\Артем>npm install -g socket.io --msvs_version=2010

> bufferutil@1.1.0 install C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil
> node-gyp rebuild

C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modules\bufferuti
l>if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-
gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  reb
uild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, до
бавьте параметр "/m".
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Cannot open include file: 'v8.h': N
o such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modul
es\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modu
les\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No description
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No repository field.
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No README data
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "install" "-g" "socket.io" "--msvs_version=2010"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Артем\npm-debug.log

C:\Users\Артем>

The root of this issue is that Microsoft's willingness to provide a c/c++ compiler on Windows is lackluster. Right?  Is there not some other approach (e.g. using a Cygwin DLL or something from MinGW ) that might suffice?

@Sogl
I didn't follow from the beginning. Take a look at Updating npm's bundled node gyp if you already haven't.

Other solution would be to settle a non MSFT compiler and use one that is still available for the plateform.

@baazoo
Didn't help.
@thoroc
Also found info about build with pangyp:
npm i pangyp -g
npm config set node-gyp pangyp

Also this tool works with io.js.
For me it doesn't work because my userprofile name in Russian.
But it still use MS compiler...

Well I am resorting to install a VM with Ubuntu on it for dev. But I am not really happy to have to change OS just because node-gyp is forcing me into installing MSFT dev tooling. From I have read changing to an FOSS C++ compiler would mean a major refactoring of the tool itself. Which incidently and understandly, no one wants to undertake.

@Sogl
I just encounterd similar issue when trying to install gulp-devtools.
c:\users\hamed\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083
: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\h
amed\AppData\Roaming\npm\node_modules\gulp-devtools\node_modules\socket.io\node
_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
  validation.cc
c:\users\hamed\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083
: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\h
amed\AppData\Roaming\npm\node_modules\gulp-devtools\node_modules\socket.io\node
_modules\socket.io-client\node_modules\ws\build\validation.vcxproj]

This is what worked for me:

Switched terminal from Powershell to CMD (Powershell didn't work)
set GYP_MSVS_VERSION=2015
Installed the package in my case npm install -g gulp-devtools

There is one more suggestion!

@baazoo
Just tried things you describe.
Same 'v8.h' error =(
One last step that I want to try - install VS 2015 :satisfied:

I also resorted to the workflow @thoroc described (using a VM inside Windows).

@thoroc
@b-long
Yep, guys. This problem also has led me to use Vagrant and Scotch Box.

Sorry. The solution can't be "use a vm instead"

The root of this issue is that Microsoft's willingness to provide a c/c++ compiler on Windows is lackluster. Right? Is there not some other approach (e.g. using a Cygwin DLL or something from MinGW ) that might suffice?

@b-long can you elaborate on that? I'm sorry, but I'm a newbie :)

I have VS 2015 community, the build tools and nothing seems to work.... I keep getting a NanThrowError.  I have the VC++ distribution, have set the msvs version, nothing seems to work.
Any insight or suggestions are greatly appreciated.
C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc>if not defined npm_config_n
ode_gyp (node "H:\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\n
ode-gyp\bin\node-gyp.js" configure build )  else (node  configure build )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
odbc.cpp
odbc_connection.cpp
odbc_statement.cpp
odbc_result.cpp
dynodbc.cpp
..\src\odbc_connection.cpp(436): error C2668: 'NanThrowError': ambiguous call t
o overloaded function [C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\bui
ld\odbc_bindings.vcxproj]
C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\node_modules\nan\nan.h(7
19): note: could be 'void NanThrowError(v8::Handlev8::Value)' (compiling so
urce file ..\src\odbc_connection.cpp)
C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\node_modules\nan\nan.h(7
11): note: or       'void NanThrowError(v8::Handlev8::String)' (compiling s
ource file ..\src\odbc_connection.cpp)
C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\node_modules\nan\nan.h(7
11): note: or       'void NanThrowError(const char *)' (compiling source file
..\src\odbc_connection.cpp)

@luisrudge Sorry, I'm a bit of a compiler newbie myself.  Maybe @TooTallNate or someone else at Joyent ( @trevnorris ?) can comment.  I'm fairly certain node-gyp on Windows is a pain point for many developers and as such, do my own compilation in a VM or remote server when I'm stuck on Windows.
There's this discussion on StackOverflow, but IMHO we can do better than a variety of "try this..." or "maybe that?".  Personally, I'd suggest my workflow (get yourself cygwin and ssh to something else).  Otherwise, wait until Microsoft does something about this (they say they support the development of NodeJS) or until NodeJS core team addresses it.
Lastly, I'm also pretty sure this isn't @TooTallNate's fault :smile: .  As far as I can tell, he was filling a gap that needed to be filled.  This is the 85% solution and many people owe Nate thanks for it, but now the community needs to push the effort even further.

I'm sure it isn't @TooTallNate's fault. This issue was never intended to point a finger to anyone. With that being said, this workflow NEEDS to get better, hence the issue. How can Microsoft fix this? What needs to be done to fix this? Knowing this, we can move this discussion forward with MSFT people.

Oh no, I know you didn't think it's Nate's fault :)  I just didn't want Nate to think, that I think, that it's his fault.  I guess a better solution would be a script-able (or npm install-able) compiler, with proper settings, etc. as defaults.
That doesn't need to come from Microsoft, but it has to work on Windows and they know Windows better than anyone.  Maybe some of the folks working on https://github.com/Microsoft/nodejstools or https://github.com/Azure/azure-sdk-for-node would know someone or know something about solving this?

@mousetraps @paulvanbrenk would you mind taking a look on this thread? :) Thanks!

IMO we might as well wave a dead chicken as expect a proper solution from MS.  There are so many forces pulling in different directions in a company that size, and I doubt they would be able to steer things in the right direction just to help the node community even if they wanted to. (No offence intended to the MS people linked above.  And I'd love to be proven wrong).
Is there a viable route we could take that didn't rely on MS compilers (or VMs)? (Perhaps that is a stupid question - I really don't know)

I intsalled nodejstools in VS 2015 and int trying to do the compile in VS2015, I get the same errors ......

@donaldhook If an error occurs with node-gyp when you're installing https://github.com/Microsoft/nodejstools , perhaps writing an issue there would spur someone from MS to investigate ?

Will do ...

@luisrudge thx for the tag - agreed it's super frustrating... we'll see what we can do on our end to help improve the experience.
@bgSosh challenge accepted :smiley:

challenge accepted

Nice!  Good luck @mousetraps :)

After installing MSVS 2015, node-gyp builds failed, so I uninstalled 2015, and ran a "repair" install over my existing 2010 installation. This fixed the failing node-gyp builds for me.
Hopefully this helps someone.

@mousetraps thank you very much! Please keep us posted :)

Dug into this a bit today, and have some good news.
VS isn't actually required - we didn't really publicize this much, but Microsoft released the C++ compiler pkg targeting Python 2.7 a while ago, so you should be able to replace the download-VS step with the following download:
http://aka.ms/vcpython27
More details here. The caveat is that there is no official support for this, so don't expect bug fixes, etc..
AFAIK... that combined w/ python 2.7 & the Windows SDK should be sufficient, but someone else should probably verify.
Hope that helps, and let us know if you have any ideas of how we can further improve the Windows experience. The more concrete/actionable, the better.

so, we have to install python, Microsoft Visual C++ Compiler for Python 2.7 and the windows sdk? do you have a link for the win sdk?

@luisrudge updated my comment above so it's all in one place. And also made the disclaimer much more clear :smiley:

I installed the VC++ Python compiler to no avail ....Windows SDK 7.1 does not install due to the detection of a pre-release version of .NET 4... which, I have a 4.6 GA release ... Hopefully I can get that installed to see if that will help with the node-gyp compile issue

@donaldhook ah, gotcha. FWIW I just tried the pkg you were trying to install (odbc), and received the same errors - not entirely sure what the issue is or whether it's an issue w/ the pkg or node-gyp itself, so don't spend too much time on it... Do other pkgs work for you? like socket.io?
(for future reference, Node Tools is no longer on codeplex, so pls don't file issues there - everything is on github now https://github.com/microsoft/nodejstools)

Sara, socket.io does install, with some warnings as seen below ...  Thanks
...
C:\Users\dhook\AppData\Roaming\npm\node_modules\socket.io\node_modules
engine.io
\node_modules\ws\node_modules\utf-8-validate>if not defined
npm_config_node_gyp
(node
"H:\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp
bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel
build,
please add the "/m" switch.
validation.cc
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\exception(361):
warning C4577: 'noexcept' used with no exception handling mode specified;
termi
nation on exception is not guaranteed. Specify /EHsc
[C:\Users\dhook\AppData\Ro
aming\npm\node_modules\socket.io http://socket.io\node_modules\engine.io
http://engine.io\node_modules\ws\node_mo
dules\utf-8-validate\build\validation.vcxproj]
Creating library C:\Users\dhook\AppData\Roaming\npm\node_modules
socket.io
\node_modules\engine.io
\node_modules\ws\node_modules\utf-8-validate\build\Rel
ease\validation.lib and object
C:\Users\dhook\AppData\Roaming\npm\node_module
s\socket.io\node_modules\engine.io
\node_modules\ws\node_modules\utf-8-validat
e\build\Release\validation.exp
Generating code
Finished generating code
On Thu, Aug 6, 2015 at 7:01 PM, Sara Itani notifications@github.com wrote:

@donaldhook https://github.com/donaldhook ah, gotcha. FWIW I just tried
the pkg you were trying to install (odbc), and received the same errors -
not entirely sure what the issue is or whether it's an issue w/ the pkg or
node-gyp itself, so don't spend too much time on it... Do other pkgs work
for you? like socket.io?
(for future reference, Node Tools is no longer on codeplex, so pls don't
file issues there - everything is on github now
https://github.com/microsoft/nodejstools)
—
Reply to this email directly or view it on GitHub
https://github.com/TooTallNate/node-gyp/issues/629#issuecomment-128542489
.

@mousetraps, Still the same error after installing vc++ for python 2.7 compiler:
$ npm i -g browser-sync
npm WARN install Couldn't install optional dependency: Unsupported
C:\Users\Артем\AppData\Roaming\npm\browser-sync -> C:\Users\Артем\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js

> bufferutil@1.1.0 install C:\Users\Артем\AppData\Roaming\npm\node_modules\browser-sync\node_modules\bufferutil
> node-gyp rebuild

Артем@SOGL C:\Users\Артем\AppData\Roaming\npm\node_modules\browser-sync\node_modules\bufferutil
$ if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Cannot open include file: 'v8.h': N o such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_modules\brows er-sync\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\browser-sync\node_modules\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No description
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No repository field.
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No README data
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "-g" "browser-sync"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Артем\npm-debug.log

Same error with socket.io.
My env here: https://github.com/TooTallNate/node-gyp/issues/676

@mousetraps , Just tried to fresh VM Windows 8.1 pro x64 installation.
Node.js v 0.12.7, python 2.7.9, npm 3.2.0, VC compiler for python 2.7 only
Got this error:
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

@Sogl In my earlier comment, I was recommending a Linux VM.  Just to clarify :) Good luck!

@b-long , I already use Linux VM... but I'm curious to get to work on Windows =))

@Sogl Ah, I see.  Sorry about that.

Just did it on fresh Windows 8.1 without installing any VS!!! :star:
Installed:

Node.js v 0.12.7
npm 3.2.0
Python 2.7.9
VC++ compiler for python 2.7
MS build tools 2013
SDK for Windows 8.1
SDK for Windows 7 with SP1

Finally go to Start -> All Programs -> Microsoft Windows SDK v7.1 -> Windows SDK 7.1 Command Prompt
Packages browser-sync and socket.io installed successfully. Snapshot created.
Now I want to find a minimum set of libraries.

Great...
On Wed, Aug 12, 2015 at 9:38 AM, Artyom Mezin notifications@github.com
wrote:

Just did it on fresh Windows 8.1 without installing any VS!!! [image:
:star:]
Installed:

Node.js v 0.12.7
npm 3.2.0
Python 2.7.9
VC++ compiler for python 2.7
MS build tools 2013
SDK for Windows 8.1
SDK for Windows 7 with SP1

Finally go to Start -> All Programs -> Microsoft Windows SDK v7.1 ->
Windows SDK 7.1 Command Prompt
Packages browser-sync and socket.io installed successfully. Snapshot
created.
Now I want to find a minimum set of libraries.
—
Reply to this email directly or view it on GitHub
https://github.com/TooTallNate/node-gyp/issues/629#issuecomment-130324582
.

You need only these things to fix problem with node-gyp on Windows 8.1:

Node.js v 0.12.7
npm 3.2.0
Python 2.7.9
SDK for Windows 7 with SP1
Install tools with Windows SDK 7.1 Command Prompt.

All VM programs:

Those who are struggling with making it work with VS 2015 don't forget to make sure you've installed the C++ part of VS 2015.

I had installed that as part of the VS2015 and had issues ... so make sure
you have the other items installed....
On Thu, Aug 13, 2015 at 7:48 AM, thorn0 notifications@github.com wrote:

Those who are struggling with making it work with VS 2015 don't forget to
make sure you've installed the C++ part of VS 2015.
[image: image]
https://cloud.githubusercontent.com/assets/94334/9250024/a3ca627a-41d2-11e5-8efb-1417d686eaa4.png
—
Reply to this email directly or view it on GitHub
https://github.com/TooTallNate/node-gyp/issues/629#issuecomment-130657536
.

@donaldhook Do you get the errors only when installing odbc? What about other packages (e.g. socket.io)?

Had errors there too ....
On Thu, Aug 13, 2015 at 8:32 AM, thorn0 notifications@github.com wrote:

@donaldhook https://github.com/donaldhook Do you get the errors only
when installing odbc? What about other packages (e.g. socket.io)?
—
Reply to this email directly or view it on GitHub
https://github.com/TooTallNate/node-gyp/issues/629#issuecomment-130672896
.

What did these errors say?

My mistake.  I tried installing when I was having the ODBC issue.  The
errors I receive are WARNINGS...  So sorry for confusing anyone or making
more work.
I had posted on the ODBC board to work through the issues.  I have found a
work around for the time being using the JDBC npm package.
Thanks to all of you working on the issue!
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\exception(361):
warning C4577: 'noexcept' used with no exception handling mode specified;
termi
nation on exception is not guaranteed. Specify /EHsc
[C:\Users\dhook\AppData\Ro
aming\npm\node_modules\socket.io
\node_modules\socket.io-client\node_modules\eng
ine.io-client\node_modules\ws\node_modules\utf-8-validate\build\validation.vcxp
roj]
On Thu, Aug 13, 2015 at 8:38 AM, thorn0 notifications@github.com wrote:

What did these errors say?
—
Reply to this email directly or view it on GitHub
https://github.com/TooTallNate/node-gyp/issues/629#issuecomment-130675383
.

@mousetraps, Can you help me with this?
I found a workaround without VS or VC++ compiler for Python, but it not works on clean Windows 10 and often not work on not clean WIndows 8.1 because I can't install SDK 7.1.
See my previous message:
https://github.com/TooTallNate/node-gyp/issues/629#issuecomment-130513913

Important info!!11
If your Windows profile folder name has non-english chars (my had russian) - change it!
Like this
Because there is path "C:\Users___\AppData\Roaming\npm" in %PATH%, where v8.h and other headers located.

@ukrbublik , You right! Just tried with russian username in Windows 8 and got the same v8.h error, but with eng. username compilation done well.

Doens't work for me. Install VC2015 (Windows 10 x64 bits) and when I try to install bcrypt, it still gets me the node-gyp errors:
C:\Users\mesos_000\Desktop\elixir Projects\testingBlog>npm install -g bcrypt
|
> bcrypt@0.8.5 install C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt
> node-gyp rebuild

C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node
_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  blowfish.cc
  bcrypt.cc
  bcrypt_node.cc
..\src\bcrypt.cc(232): warning C4267: '=' : conversion from 'size_t' to 'unsigned char', possible loss of data [C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcryp
t\build\bcrypt_lib.vcxproj]
c:\users\mesos_000\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory (..\src\bcrypt_nod
e.cc) [C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "bcrypt"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\mesos_000\Desktop\elixir Projects\testingBlog\npm-debug.log

@mesosteros Do you actually have winsock2.h anywhere in Program files or Program files (x86)?

@thorn0 no. Don't even know what that is.

It's a part of the Windows SDK. Just to confirm, did you perform a recursive search for this file in those folders?

@thorn0 no. But the sdk isn't installing. I'm trying MicrosoftFixit to correct the installation. In the meantime I'm performing the search for winsock2.h

@thorn0 Ok it seems I have winsock2.h on my Program Files (x86) at the Windows Kit and Windows Phone Kits folders

So you have the SDK.

Seems so...

I had issues installing the SDK as well, it wouldnt allow me to install it.
On Tue, Aug 18, 2015 at 10:30 AM, Carlos Santos notifications@github.com
wrote:

@thorn0 https://github.com/thorn0 no. But the sdk isn't installing. I'm
trying MicrosoftFixit to correct the installation. In the meantime I'm
performing the search for winsock2.h
—
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node-gyp/issues/629#issuecomment-132251191.

It might be that node-gyp requires just the Windows 7 SDK. It's installed if you tick off Windows XP Support for C++ in the VS setup. Did you tick it off?

@thorn0 I ticked what you said here but on. https://github.com/nodejs/node-gyp/issues/629#issuecomment-130657536

@mesosteros, I spent about month with C1083 error to resolve it. It was profile name bug =(
What npm version and Windows version you have?
Did you try to rename your profile folder from mesos_000 to mesos? You can just create another profile in Windows.
Also try to clear .node-gyp folder before build.
Did you try to build from SDK 7.1 command prompt? All prompts must be Run as Administrator.

@Sogl My npm version is 2.11.3 and I'm using Windows 10 Home x64 bits.
My prompts are being run as administrator and I've also tried the Developer Command Prompt.
I'll try changing profile name.

My npm version is 2.11.3

I recommend 3.x. Some windows long path bugs has been fixed and more.

Couldn't manage to change my user folder since I have the Home version. Anyway it shouldn't matter since it's running from Program Files and not users. I managed to update npm and still I get the same errors.
I find this issue absolutely ridiculous: I'm just trying to add a package (addict) to an Elixir project, but that package has a dependency on another package (comeonin) which in turn points to a dependency compilation error in bcrypt wich in turn points to its dependency on node-gyp giving this error.

Couldn't manage to change my user folder since I have the Home version.

In Home you can't put your computer into Domain, can't use group policy management and some other small things... I can't see problem with profile.

Six steps that I did:

Add +1 admin account
Login with this new account in Safe Mode
Open regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
Change selected key with old user name to new

Rename your C:\Users\old profile to C:\Users\new.
Reboot and log-in to your account. Now you can delete useless admin account.

Some more info here:
http://sd-onsite.com/how-to-rename-microsoft-account-usernames-and-user-folders-in-windows-8/

Anyway it shouldn't matter since it's running from Program Files and not users.

Nope. Npm uses appdata folder because it's a global module but running from program files. Also you can see that from your console output:
C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node
_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  blowfish.cc
  bcrypt.cc
  bcrypt_node.cc
..\src\bcrypt.cc(232): warning C4267: '=' : conversion from 'size_t' to 'unsigned char', possible loss of data [C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcryp
t\build\bcrypt_lib.vcxproj]
c:\users\mesos_000\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory (..\src\bcrypt_nod
e.cc) [C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt\build\bcrypt_lib.vcxproj]

Steps to update npm on Windows:

cmd
npm i -g npm@3.2.0 (global update)
cd "C:\Program Files\nodejs" and npm i npm@3.2.0
npm -v (must be 3.2.0)

Managed to do what I wanted with a symlink created.

@mesosteros, Can you describe what you have done?

@Sogl I did it like so:
Run Command Prompt (as administrator):
cd C:\Users
mklink /d mesos mesos_000
Then run the Developer Command Prompt installed with Visual Studio 2015 (from the start menu -> applications), also as administrator, going to
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
and running the command vcvarsall.bat amd64
Finally, I created a completely new phoenix project in my elixir projects folder, added
{:addict, ">= 0.1.0"}
mix deps.get
mix deps.compile comeonin
and pronto.

Windows 7, Visual Studio 2013 Professional, python 2.7.3, tried doing
npm install kafka-node
Both it failed gloriously, all coming down to this one
npm install snappy
Went through a ton of instructions on how to set things up, got the Windows SDK 7.1, the Microsoft Build Tools 2013 and thing seem to progress well, then I finally get this error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(507,5): error MSB8008: Specified platform toolset (v120) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected. [D:\sample\node_modules\snappy\build\deps\snappy\snappy.vcxproj]
For the life of me I can't get past this, check a couple things on the internet, and still can't find a way to get around it, even though node-gyp and pangyp say they support VS2013 on Windows 7
I ended up finding this page: https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/
Went through the additional steps, setting msvs_version to 2010 and installing VS2010 + SP1
Voila, everything installs.
I need to make instructions for the rest of my development team to set this up, and having them install Windows SDK (seems unavoidable), VS2010 (seems avoidable) and setting up an msvs_version seems like a whole heck of a lot more per-user setup than should be neccesary

my current setup is this:

Install visual studio with the visual c++ option enabled
install python2
setx GYP_MSVS_VERSION 2015 (i'm using visual studio 2015)

after that, everything runs just fine.

@mesosteros, Good! I'll try it today on my VM.
@dekarguy, v120 = vs 2012
Did you try to specify vs 2013 version with --msvs_version=2013? I didn't install vs 2010 in my last configuration.

@Sogl Definitely tried with --msvs_version=2013, v120 is actually 2013, really confusing and annoying
@luisrudge setx SYP_MSVS_VERSION 2013 didn't help

it's GYP_MSVS_VERSION

fixed my typo and no dice

:( Did you install the visual c++ thing?

On my Windows 7 x64, node-gyp works fine with VS2015 without setting GYP_MSVS_VERSION. If we summarize what's been written in this issue about VS2015, we'll get only two important points to check:

The C++ part of the VS was installed. By default, it isn't.
The user profile folder is named only in English letters. No other languages, no characters like underscores etc.

@luisrudge Are you sure GYP_MSVS_VERSION is really required? Doesn't it work for you without it?

win 8.1 x64
installed Python compiler
installed npm 3.2
installed Visual Studio Express 2105
installed Windows 7 SDK
added user with latin-only name
it compiles!
Run cmd NOT as admin (user with latin-only name in dir path)
cmd:
SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140   - some problems with my APTH
set GYP_MSVS_VERSION 2015
npm install
and it's done! (problem was with compiling bcrypt)
Thanks a lot for all advises! Hope my info will be useful

@ProtomotoReal Thank you!!!
I was able to run a normal cmd window (not the Windows SDK 7.1 prompt)
SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
I didn't need to set the GYP_MSVS_VERSION, nor the npm config msvs_version variable
It looks like for my team to get set up on Windows 7 + Visual Studio 2013 that the steps will be
Install Python 2.7
npm set python C:\Python27\python.exe --global
Install Windows 7 SDK
SET VCTargetsPath=C:\Program Files (x86)\MSBUILD\Microsoft.Cpp\v4.0\V120
npm install
Thank you all for the help, I think we can all agree that making this easier would be grand

Hi, i had the same problems with npm-gyp. Initially i got a build problem and i solved it following the suggestions in this thread. I have:
Windows 7 x64 Ultimate
VS 2012
VS 2013
VS 2015
Python 2.7.6
NPM 2.13.3
NODE 0.12.7
Microsoft Windows SDK 7.1
but during the npm install exit with only an error on parsing package.json:
'R:\Progetti\Nodejs\relay>npm install
npm WARN peerDependencies The peer dependency babel-core@* included from babel-loader will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

utf-8-validate@1.1.0 install R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engi
ne.io-client\node_modules\ws\node_modules\utf-8-validate
node-gyp rebuild

R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\no
de_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Users\Piero\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bi
n\....\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Compilazione dei progetti nella soluzione uno alla volta. Per abilitare la compilazione parallela, aggiungere l'opzione "/m".
validation.cc
Creating library R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-cl
ient\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.lib and object R:\Progetti\Nodejs\relay\node_modules\webpa
ck-dev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate\build\Release
validation.exp
Generating code
Finished generating code
validation.vcxproj -> R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-
client\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.node

bufferutil@1.1.0 install R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.i
o-client\node_modules\ws\node_modules\bufferutil
node-gyp rebuild

R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\no
de_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Users\Piero\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\.
...\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Compilazione dei progetti nella soluzione uno alla volta. Per abilitare la compilazione parallela, aggiungere l'opzione "/m".
bufferutil.cc
Creating library R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-cl
ient\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.lib and object R:\Progetti\Nodejs\relay\node_modules\webpack-d
ev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil\build\Release\bufferut
il.exp
Generating code
Finished generating code
bufferutil.vcxproj -> R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-
client\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.node
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "node" "C:\Users\Piero\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.3
npm ERR! file C:\Users\Piero\AppData\Roaming\npm-cache\qs\4.0.0\package\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\Piero\AppData\Roaming\npm-cache\qs\4.0.0\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR!     R:\Progetti\Nodejs\relay\npm-debug.log
'
it seems the soccket.io-client gives problems

@pierol, Your node-gyp works fine.
I think this can help:
http://stackoverflow.com/questions/17944345/npm-install-cannot-read-package-json

@Sogl i solved thank you the reason was corrupted packages.json files on disk.

ProtomotoReal, many thanx! Finally got it going after a whole weekend of wanting to throw my laptop out the window!
This helped fixing my issues: https://github.com/nodejs/node-gyp/issues/629#issuecomment-132991527

@Sogl / @dekarguy  - So to get it to work on Win7 still requires installing VS?
SDK is not enough?

@erezcohen My guess is yes, at the very least the build tools, but I'm not sure if they will install the C++ Foundation headers. I don't have a clean machine available to test without Visual Studio since my whole team uses it for Windows development, just getting everything built with 2013 was enough for us.

@erezcohen, SDK is enough, but you must use SDK console for installation.
Tested on clean Win 8.1 virtual machine.

Thanks guys.
Though I must say - this whole mess still seems unacceptable to me.
I have to spill my guts here and also have a question - please bare with me...
This thread is titled "Windows users are not happy" - and indeed I'm unhappy still - Not that I don't appreciate the effort and contribution!
NOTE: We're using node/npm as a build engine for our web app - not for server development. (Our dev environment is windows, though the server is java based).
I recently wanted to upgrade our node and than ran into this issue. Currently our continuous integration runs our unit tests multiple times a day on windows slaves. It's a simple environment that starts from a clean machine and installs, using few simple maven steps, node+grunt and execute the tests. The whole thing runs in less than 15 minutes. Throwing onto that the above MS stack (I'm using the word stack out of politeness..) is as I said unacceptable.
The inevitable conclusion I made was that I'll either have to switch to unix or stay with an outdated node  server. For now we chose the latter.
This is actually working well for our needs so far, but of course this is not a sustainable solution.
As far as I saw, the node-gyp was only used in our env by the (similarly outdated) grunt-sass package - which still does its job well.
Which brings me to my questions:

Why was this change done?
(Found this - http://stackoverflow.com/questions/26959640/why-does-node-gyp-and-other-stuff-require-visual-studio - but unanswered)
Could there be a way to use the previous mechanism with a new node?
I mean perhaps enable running node with a flag to override this behavior?

Thanks and apologies...

Why was this change done? (Found this - http://stackoverflow.com/questions/26959640/why-does-node-gyp-and-other-stuff-require-visual-studio - but unanswered)

Because node-gyp needs a C++ compiler.   Most platforms ship them by default but not Windows.
There has been talk of downloading and installing the compiler automatically.  I understand that's the approach depot_tools takes.

Because node-gyp needs a C++ compiler. Most platforms ship them by default but not Windows

Agree and it requires GBs large VS to download in order to get the C++ compiler.
On this note, please give your +3 on this: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6742251-make-c-c-compiler-cl-exe-independent-of-ide, to convince the VC team. :)

@sogl and others... I also have Windows 10 and cannot make it work, because of the SDK 7 failure. Did you find any other solution? Thanks.

@af7 Did you install the C++ part of VS 2015? It includes the SDK.

@thorn0 Trying... because when trying to do so, I have to fight another (ridiculous) MS problem that does not even allow me to install VS 2015 using its own EXE installer!!!:
The "dreaded" message "A setup project is either missing or damaged"!  (while Windows 10 are quite clean and the installer downloads all files from the MS website)
See another user mentioning it here:
https://social.msdn.microsoft.com/Forums/en-US/c433f65f-02be-4a32-8175-24527d5447b9/a-setup-project-is-either-missing-or-damaged?forum=msbuild
So, my next approach is to wait for the 3.3GB of the ISO to be downloaded, cross my fingers, and hopefully VS 2015 gets installed.
Then, I will report back...  (what a nightmare/joke)

We have a couple coworkers who ended up getting everything working on Windows 10 and VS 2013. Make sure the VS 2010 redistributables are removed, run the SDK 7.1 installer, continue past the warnings that you have a beta version of the .NET framework (you can still continue the installer past this point) and see the installer to completion.

@dekarguy Aha! Tried this too! But then I get the other dreaded message from MS at the very beginning of the installation:
"Some components cannot be installed, blah blah blah, click OK to continue"
So, I did not want to continue, but I can assume from your valuable reporting that if I continue this may work. But then, do I really need the VS 2013 also installed? Because @Sogl above says that SDK 7.1 would be enough (along with Python, etc.).

Hm... guys, something changed in npm because now it not uses user profile folder! Found it on new virtual machines.
Just tested on clean VM with Windows 7 x64, VS not installed. Output:
> utf-8-validate@1.1.0 install C:\nodejs\node_modules\browser-sync\node_modules\
utf-8-validate
> node-gyp rebuild

C:\nodejs\node_modules\browser-sync\node_modules\utf-8-validate>if not defined n
pm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\nod
e_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Построение проектов в этом решении по одному. Чтобы включить параллельное постро
ение, добавьте параметр "/m".
  validation.cc
     Creating library C:\nodejs\node_modules\browser-sync\node_modules\utf-8-va
  lidate\build\Release\validation.lib and object C:\nodejs\node_modules\browser
  -sync\node_modules\utf-8-validate\build\Release\validation.exp
  Generating code
  Finished generating code
  validation.vcxproj -> C:\nodejs\node_modules\browser-sync\node_modules\utf-8-
  validate\build\Release\\validation.node

> utf-8-validate@1.1.0 install C:\nodejs\node_modules\browser-sync\node_modules\
utf-8-validate
> node-gyp rebuild

C:\nodejs\node_modules\browser-sync\node_modules\utf-8-validate>if not defined n
pm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\nod
e_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Построение проектов в этом решении по одному. Чтобы включить параллельное постро
ение, добавьте параметр "/m".
  validation.cc
     Creating library C:\nodejs\node_modules\browser-sync\node_modules\utf-8-va
  lidate\build\Release\validation.lib and object C:\nodejs\node_modules\browser
  -sync\node_modules\utf-8-validate\build\Release\validation.exp
  Generating code
  Finished generating code
  validation.vcxproj -> C:\nodejs\node_modules\browser-sync\node_modules\utf-8-
  validate\build\Release\\validation.node

> bufferutil@1.1.0 install C:\nodejs\node_modules\browser-sync\node_modules\buff
erutil
> node-gyp rebuild

C:\nodejs\node_modules\browser-sync\node_modules\bufferutil>if not defined npm_c
onfig_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo
dules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Построение проектов в этом решении по одному. Чтобы включить параллельное постро
ение, добавьте параметр "/m".
  bufferutil.cc
     Creating library C:\nodejs\node_modules\browser-sync\node_modules\bufferut
  il\build\Release\bufferutil.lib and object C:\nodejs\node_modules\browser-syn
  c\node_modules\bufferutil\build\Release\bufferutil.exp
  Generating code
  Finished generating code
  bufferutil.vcxproj -> C:\nodejs\node_modules\browser-sync\node_modules\buffer
  util\build\Release\\bufferutil.node
C:\nodejs
└─┬ browser-sync@2.9.1
  ├─┬ anymatch@1.3.0
  │ ├── arrify@1.0.0
  │ └─┬ micromatch@2.2.0
  │   ├─┬ arr-diff@1.1.0
  │   │ ├── arr-flatten@1.0.1
  │   │ └── array-slice@0.2.3
  │   ├── array-unique@0.2.1
  │   ├─┬ braces@1.8.1
  │   │ ├─┬ expand-range@1.8.1
  │   │ │ └─┬ fill-range@2.2.2
  │   │ │   ├── is-number@1.1.2
  │   │ │   └── randomatic@1.1.0
  │   │ ├── lazy-cache@0.2.3
  │   │ ├── preserve@0.2.0
  │   │ └── repeat-element@1.1.2
  │   ├── expand-brackets@0.1.4
  │   ├─┬ extglob@0.3.1
  │   │ ├─┬ ansi-green@0.1.1
  │   │ │ └── ansi-wrap@0.1.0
  │   │ ├── is-extglob@1.0.0
  │   │ └── success-symbol@0.1.0
  │   ├── filename-regex@2.0.0
  │   ├── kind-of@1.1.0
  │   ├─┬ object.omit@1.1.0
  │   │ ├─┬ for-own@0.1.3
  │   │ │ └── for-in@0.1.4
  │   │ └── isobject@1.0.2
  │   ├─┬ parse-glob@3.0.2
  │   │ ├── glob-base@0.2.0
  │   │ └── is-dotfile@1.0.1
  │   └─┬ regex-cache@0.4.2
  │     ├── is-equal-shallow@0.1.3
  │     └── is-primitive@2.0.0
  ├── async-each-series@0.1.1
  ├─┬ browser-sync-client@2.3.0
  │ ├── etag@1.7.0
  │ └── fresh@0.3.0
  ├─┬ browser-sync-ui@0.5.15
  │ ├── connect-history-api-fallback@0.0.5
  │ ├─┬ stream-throttle@0.1.3
  │ │ ├─┬ commander@2.8.1
  │ │ │ └── graceful-readlink@1.0.1
  │ │ └── limiter@1.0.5
  │ └─┬ weinre@2.0.0-pre-I0Z7U9OV
  │   ├─┬ express@2.5.11
  │   │ ├─┬ connect@1.9.2
  │   │ │ └── formidable@1.0.17
  │   │ ├── mime@1.2.4
  │   │ ├── mkdirp@0.3.0
  │   │ └── qs@0.4.2
  │   ├─┬ nopt@3.0.3
  │   │ └── abbrev@1.0.7
  │   └── underscore@1.7.0
  ├─┬ chokidar@1.0.5
  │ ├── async-each@0.1.6
  │ ├── glob-parent@1.2.0
  │ ├─┬ is-binary-path@1.0.1
  │ │ └── binary-extensions@1.3.1
  │ ├── is-glob@1.1.3
  │ ├── path-is-absolute@1.0.0
  │ └─┬ readdirp@1.4.0
  │   ├── graceful-fs@4.1.2
  │   ├─┬ minimatch@0.2.14
  │   │ ├── lru-cache@2.6.5
  │   │ └── sigmund@1.0.1
  │   └─┬ readable-stream@1.0.33
  │     ├── core-util-is@1.0.1
  │     └── string_decoder@0.10.31
  ├─┬ connect@3.4.0
  │ ├─┬ debug@2.2.0
  │ │ └── ms@0.7.1
  │ ├─┬ finalhandler@0.4.0
  │ │ ├─┬ on-finished@2.3.0
  │ │ │ └── ee-first@1.1.1
  │ │ └── unpipe@1.0.0
  │ ├── parseurl@1.3.0
  │ └── utils-merge@1.0.0
  ├── dev-ip@1.0.1
  ├─┬ easy-extender@2.3.1
  │ └── lodash@2.4.2
  ├─┬ eazy-logger@2.1.2
  │ ├─┬ opt-merger@1.1.0
  │ │ └── lodash@2.4.2
  │ └─┬ tfunk@3.0.1
  │   ├─┬ chalk@0.5.1
  │   │ ├── ansi-styles@1.1.0
  │   │ ├── escape-string-regexp@1.0.3
  │   │ ├─┬ has-ansi@0.1.0
  │   │ │ └── ansi-regex@0.2.1
  │   │ ├── strip-ansi@0.3.0
  │   │ └── supports-color@0.2.0
  │   └── object-path@0.9.2
  ├── emitter-steward@0.0.1
  ├─┬ foxy@11.1.3
  │ ├── cookie@0.1.3
  │ ├─┬ http-proxy@1.11.2
  │ │ ├── eventemitter3@1.1.1
  │ │ └── requires-port@0.0.1
  │ ├─┬ lodash.merge@3.3.2
  │ │ ├── lodash._arraycopy@3.0.0
  │ │ ├── lodash._arrayeach@3.0.0
  │ │ ├─┬ lodash._createassigner@3.1.1
  │ │ │ ├── lodash._bindcallback@3.0.1
  │ │ │ ├── lodash._isiterateecall@3.0.9
  │ │ │ └── lodash.restparam@3.6.1
  │ │ ├── lodash._getnative@3.9.1
  │ │ ├── lodash.isarguments@3.0.4
  │ │ ├── lodash.isarray@3.0.4
  │ │ ├─┬ lodash.isplainobject@3.2.0
  │ │ │ └── lodash._basefor@3.0.2
  │ │ ├── lodash.istypedarray@3.0.2
  │ │ ├── lodash.keys@3.1.2
  │ │ ├── lodash.keysin@3.0.8
  │ │ └─┬ lodash.toplainobject@3.0.0
  │ │   └── lodash._basecopy@3.0.1
  │ └─┬ resp-modifier@4.0.4
  │   └── minimatch@2.0.10
  ├── immutable@3.7.5
  ├─┬ localtunnel@1.7.0
  │ ├── debug@0.7.4
  │ ├── openurl@1.1.0
  │ ├── request@2.11.4
  │ └─┬ yargs@3.15.0
  │   ├── camelcase@1.2.1
  │   ├─┬ cliui@2.1.0
  │   │ ├─┬ center-align@0.1.1
  │   │ │ └─┬ align-text@0.1.3
  │   │ │   └─┬ kind-of@2.0.1
  │   │ │     └── is-buffer@1.0.2
  │   │ ├── right-align@0.1.3
  │   │ └── wordwrap@0.0.2
  │   ├── decamelize@1.0.0
  │   └── window-size@0.1.2
  ├── lodash@3.10.1
  ├── longest@1.0.1
  ├─┬ meow@3.3.0
  │ ├─┬ camelcase-keys@1.0.0
  │ │ └── map-obj@1.0.1
  │ ├─┬ indent-string@1.2.2
  │ │ ├── get-stdin@4.0.1
  │ │ └─┬ repeating@1.1.3
  │ │   └─┬ is-finite@1.0.1
  │ │     └── number-is-nan@1.0.0
  │ ├── minimist@1.2.0
  │ └── object-assign@3.0.0
  ├── opn@2.0.1
  ├─┬ pad-left@1.0.2
  │ └── repeat-string@1.5.2
  ├─┬ portscanner@1.0.0
  │ └── async@0.1.15
  ├─┬ query-string@2.4.1
  │ └── strict-uri-encode@1.0.2
  ├─┬ resp-modifier@5.0.2
  │ └─┬ minimatch@2.0.10
  │   └─┬ brace-expansion@1.1.0
  │     ├── balanced-match@0.2.0
  │     └── concat-map@0.0.1
  ├─┬ serve-index@1.7.2
  │ ├─┬ accepts@1.2.12
  │ │ └── negotiator@0.5.3
  │ ├── batch@0.5.2
  │ ├── escape-html@1.0.2
  │ ├─┬ http-errors@1.3.1
  │ │ ├── inherits@2.0.1
  │ │ └── statuses@1.2.1
  │ └─┬ mime-types@2.1.6
  │   └── mime-db@1.18.0
  ├─┬ serve-static@1.10.0
  │ └─┬ send@0.13.0
  │   ├── depd@1.0.1
  │   ├── destroy@1.0.3
  │   ├── mime@1.3.4
  │   └── range-parser@1.0.2
  ├─┬ socket.io@1.3.6
  │ ├─┬ debug@2.1.0
  │ │ └── ms@0.6.2
  │ ├─┬ engine.io@1.5.2
  │ │ ├── base64id@0.1.0
  │ │ ├─┬ debug@1.0.3
  │ │ │ └── ms@0.6.2
  │ │ ├─┬ engine.io-parser@1.2.1
  │ │ │ ├── after@0.8.1
  │ │ │ ├── arraybuffer.slice@0.0.6
  │ │ │ ├── base64-arraybuffer@0.1.2
  │ │ │ ├── blob@0.0.2
  │ │ │ ├── has-binary@0.1.5
  │ │ │ └── utf8@2.0.0
  │ │ └─┬ ws@0.7.2
  │ │   ├─┬ bufferutil@1.1.0
  │ │   │ ├── bindings@1.2.1
  │ │   │ └── nan@1.8.4
  │ │   ├── options@0.0.6
  │ │   ├── ultron@1.0.2
  │ │   └── utf-8-validate@1.1.0
  │ ├─┬ has-binary-data@0.1.3
  │ │ └── isarray@0.0.1
  │ ├─┬ socket.io-adapter@0.3.1
  │ │ ├─┬ debug@1.0.2
  │ │ │ └── ms@0.6.2
  │ │ ├── object-keys@1.0.1
  │ │ └─┬ socket.io-parser@2.2.2
  │ │   └── debug@0.7.4
  │ ├─┬ socket.io-client@1.3.6
  │ │ ├── backo2@1.0.2
  │ │ ├── component-bind@1.0.0
  │ │ ├── component-emitter@1.1.2
  │ │ ├── debug@0.7.4
  │ │ ├─┬ engine.io-client@1.5.2
  │ │ │ ├── component-inherit@0.0.3
  │ │ │ ├─┬ debug@1.0.4
  │ │ │ │ └── ms@0.6.2
  │ │ │ ├─┬ has-cors@1.0.3
  │ │ │ │ └── global@2.0.1
  │ │ │ ├── parsejson@0.0.1
  │ │ │ ├── parseqs@0.0.2
  │ │ │ ├── parseuri@0.0.4
  │ │ │ └── xmlhttprequest@1.5.0
  │ │ ├── has-binary@0.1.6
  │ │ ├── indexof@0.0.1
  │ │ ├── object-component@0.0.3
  │ │ ├─┬ parseuri@0.0.2
  │ │ │ └─┬ better-assert@1.0.2
  │ │ │   └── callsite@1.0.0
  │ │ └── to-array@0.1.3
  │ └─┬ socket.io-parser@2.2.4
  │   ├── benchmark@1.0.0
  │   ├── debug@0.7.4
  │   └── json3@3.2.6
  ├── ua-parser-js@0.7.9
  └── ucfirst@0.0.1

npm WARN EPACKAGEJSON C:\nodejs No description
npm WARN EPACKAGEJSON C:\nodejs No repository field.
npm WARN EPACKAGEJSON C:\nodejs No README data
npm WARN EPACKAGEJSON C:\nodejs No license field.

C:\Program Files\Microsoft SDKs\Windows\v7.1>

Before update npm on Windows 8.1 x64:
$ npm i -g browser-sync
npm WARN install Couldn't install optional dependency: Unsupported
C:\Users\Artyom\AppData\Roaming\npm\browser-sync -> C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-sync\bin\browser-sync.js

> bufferutil@1.1.0 install C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-sync\node_modules\bufferutil
> node-gyp rebuild

Артем@SOGL C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-sync\node_modules\bufferutil
$ if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  bufferutil.cc
     Creating library C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-
  sync\node_modules\bufferutil\build\Release\bufferutil.lib and object C:\Users
  \Artyom\AppData\Roaming\npm\node_modules\browser-sync\node_modules\bufferutil
  \build\Release\bufferutil.exp
  Generating code
  Finished generating code
  bufferutil.vcxproj -> C:\Users\Artyom\AppData\Roaming\npm\node_modules\browse
  r-sync\node_modules\bufferutil\build\Release\\bufferutil.node

> utf-8-validate@1.1.0 install C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-sync\node_modules\utf-8-validate
> node-gyp rebuild

Артем@SOGL C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-sync\node_modules\utf-8-validate
$ if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  validation.cc
     Creating library C:\Users\Artyom\AppData\Roaming\npm\node_modules\browser-
  sync\node_modules\utf-8-validate\build\Release\validation.lib and object C:\U
  sers\Artyom\AppData\Roaming\npm\node_modules\browser-sync\node_modules\utf-8-
  validate\build\Release\validation.exp
  Generating code
  Finished generating code
  validation.vcxproj -> C:\Users\Artyom\AppData\Roaming\npm\node_modules\browse
  r-sync\node_modules\utf-8-validate\build\Release\\validation.node
C:\Users\Artyom\AppData\Roaming\npm
└─┬ browser-sync@2.9.1
  ├── browser-sync-client@2.3.0
  ├─┬ foxy@11.1.3
  │ ├── http-proxy@1.11.2
  │ └─┬ resp-modifier@4.0.4
  │   └── minimatch@2.0.10
  ├── immutable@3.7.5
  ├── query-string@2.4.1
  ├─┬ resp-modifier@5.0.2
  │ └── minimatch@2.0.10
  └─┬ serve-index@1.7.2
    └─┬ mime-types@2.1.6
      └── mime-db@1.18.0

npm WARN EPACKAGEJSON C:\Users\Artyom\AppData\Roaming\npm No description
npm WARN EPACKAGEJSON C:\Users\Artyom\AppData\Roaming\npm No repository field.
npm WARN EPACKAGEJSON C:\Users\Artyom\AppData\Roaming\npm No README data
npm WARN EPACKAGEJSON C:\Users\Artyom\AppData\Roaming\npm No license field.

And after update from npm 3.2.0 to 3.2.2 on host machine with Windows 8 x64:
$ npm i -g browser-sync
npm WARN install Couldn't install optional dependency: Unsupported
c:\nodejs\browser-sync -> c:\nodejs\node_modules\browser-sync\bin\browser-sync.js

> bufferutil@1.1.0 install c:\nodejs\node_modules\browser-sync\node_modules\bufferutil
> node-gyp rebuild

Артем@SOGL c:\nodejs\node_modules\browser-sync\node_modules\bufferutil
$ if not defined npm_config_node_gyp (node "c:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  bufferutil.cc
     Creating library c:\nodejs\node_modules\browser-sync\node_modules\bufferut
  il\build\Release\bufferutil.lib and object c:\nodejs\node_modules\browser-syn
  c\node_modules\bufferutil\build\Release\bufferutil.exp
  Generating code
  Finished generating code
  bufferutil.vcxproj -> c:\nodejs\node_modules\browser-sync\node_modules\buffer
  util\build\Release\\bufferutil.node

> utf-8-validate@1.1.0 install c:\nodejs\node_modules\browser-sync\node_modules\utf-8-validate
> node-gyp rebuild

Артем@SOGL c:\nodejs\node_modules\browser-sync\node_modules\utf-8-validate
$ if not defined npm_config_node_gyp (node "c:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  validation.cc
     Creating library c:\nodejs\node_modules\browser-sync\node_modules\utf-8-va
  lidate\build\Release\validation.lib and object c:\nodejs\node_modules\browser
  -sync\node_modules\utf-8-validate\build\Release\validation.exp
  Generating code
  Finished generating code
  validation.vcxproj -> c:\nodejs\node_modules\browser-sync\node_modules\utf-8-
  validate\build\Release\\validation.node

> bufferutil@1.1.0 install c:\nodejs\node_modules\browser-sync\node_modules\bufferutil
> node-gyp rebuild

Артем@SOGL c:\nodejs\node_modules\browser-sync\node_modules\bufferutil
$ if not defined npm_config_node_gyp (node "c:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  bufferutil.cc
     Creating library c:\nodejs\node_modules\browser-sync\node_modules\bufferut
  il\build\Release\bufferutil.lib and object c:\nodejs\node_modules\browser-syn
  c\node_modules\bufferutil\build\Release\bufferutil.exp
  Generating code
  Finished generating code
  bufferutil.vcxproj -> c:\nodejs\node_modules\browser-sync\node_modules\buffer
  util\build\Release\\bufferutil.node

> utf-8-validate@1.1.0 install c:\nodejs\node_modules\browser-sync\node_modules\utf-8-validate
> node-gyp rebuild

Артем@SOGL c:\nodejs\node_modules\browser-sync\node_modules\utf-8-validate
$ if not defined npm_config_node_gyp (node "c:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр "/m".
  validation.cc
     Creating library c:\nodejs\node_modules\browser-sync\node_modules\utf-8-va
  lidate\build\Release\validation.lib and object c:\nodejs\node_modules\browser
  -sync\node_modules\utf-8-validate\build\Release\validation.exp
  Generating code
  Finished generating code
  validation.vcxproj -> c:\nodejs\node_modules\browser-sync\node_modules\utf-8-
  validate\build\Release\\validation.node
c:\nodejs
└─┬ browser-sync@2.9.1
  ├─┬ anymatch@1.3.0
  │ ├── arrify@1.0.0
  │ └─┬ micromatch@2.2.0
  │   ├─┬ arr-diff@1.1.0
  │   │ ├── arr-flatten@1.0.1
  │   │ └── array-slice@0.2.3
  │   ├── array-unique@0.2.1
  │   ├─┬ braces@1.8.1
  │   │ ├─┬ expand-range@1.8.1
  │   │ │ └─┬ fill-range@2.2.2
  │   │ │   ├── is-number@1.1.2
  │   │ │   └── randomatic@1.1.0
  │   │ ├── lazy-cache@0.2.3
  │   │ ├── preserve@0.2.0
  │   │ └── repeat-element@1.1.2
  │   ├── expand-brackets@0.1.4
  │   ├─┬ extglob@0.3.1
  │   │ ├─┬ ansi-green@0.1.1
  │   │ │ └── ansi-wrap@0.1.0
  │   │ ├── is-extglob@1.0.0
  │   │ └── success-symbol@0.1.0
  │   ├── filename-regex@2.0.0
  │   ├── kind-of@1.1.0
  │   ├─┬ object.omit@1.1.0
  │   │ ├─┬ for-own@0.1.3
  │   │ │ └── for-in@0.1.4
  │   │ └── isobject@1.0.2
  │   ├─┬ parse-glob@3.0.2
  │   │ ├── glob-base@0.2.0
  │   │ └── is-dotfile@1.0.1
  │   └─┬ regex-cache@0.4.2
  │     ├── is-equal-shallow@0.1.3
  │     └── is-primitive@2.0.0
  ├── async-each-series@0.1.1
  ├─┬ browser-sync-client@2.3.0
  │ ├── etag@1.7.0
  │ └── fresh@0.3.0
  ├─┬ browser-sync-ui@0.5.15
  │ ├── connect-history-api-fallback@0.0.5
  │ ├─┬ stream-throttle@0.1.3
  │ │ ├─┬ commander@2.8.1
  │ │ │ └── graceful-readlink@1.0.1
  │ │ └── limiter@1.0.5
  │ └─┬ weinre@2.0.0-pre-I0Z7U9OV
  │   ├─┬ express@2.5.11
  │   │ ├─┬ connect@1.9.2
  │   │ │ └── formidable@1.0.17
  │   │ ├── mime@1.2.4
  │   │ ├── mkdirp@0.3.0
  │   │ └── qs@0.4.2
  │   ├─┬ nopt@3.0.3
  │   │ └── abbrev@1.0.7
  │   └── underscore@1.7.0
  ├─┬ chokidar@1.0.5
  │ ├── async-each@0.1.6
  │ ├── glob-parent@1.2.0
  │ ├─┬ is-binary-path@1.0.1
  │ │ └── binary-extensions@1.3.1
  │ ├── is-glob@1.1.3
  │ ├── path-is-absolute@1.0.0
  │ └─┬ readdirp@1.4.0
  │   ├── graceful-fs@4.1.2
  │   ├─┬ minimatch@0.2.14
  │   │ ├── lru-cache@2.6.5
  │   │ └── sigmund@1.0.1
  │   └─┬ readable-stream@1.0.33
  │     ├── core-util-is@1.0.1
  │     └── string_decoder@0.10.31
  ├─┬ connect@3.4.0
  │ ├─┬ debug@2.2.0
  │ │ └── ms@0.7.1
  │ ├─┬ finalhandler@0.4.0
  │ │ ├─┬ on-finished@2.3.0
  │ │ │ └── ee-first@1.1.1
  │ │ └── unpipe@1.0.0
  │ ├── parseurl@1.3.0
  │ └── utils-merge@1.0.0
  ├── dev-ip@1.0.1
  ├─┬ easy-extender@2.3.1
  │ └── lodash@2.4.2
  ├─┬ eazy-logger@2.1.2
  │ ├─┬ opt-merger@1.1.0
  │ │ └── lodash@2.4.2
  │ └─┬ tfunk@3.0.1
  │   ├─┬ chalk@0.5.1
  │   │ ├── ansi-styles@1.1.0
  │   │ ├── escape-string-regexp@1.0.3
  │   │ ├─┬ has-ansi@0.1.0
  │   │ │ └── ansi-regex@0.2.1
  │   │ ├── strip-ansi@0.3.0
  │   │ └── supports-color@0.2.0
  │   └── object-path@0.9.2
  ├── emitter-steward@0.0.1
  ├─┬ foxy@11.1.3
  │ ├── cookie@0.1.3
  │ ├─┬ http-proxy@1.11.2
  │ │ ├── eventemitter3@1.1.1
  │ │ └── requires-port@0.0.1
  │ ├─┬ lodash.merge@3.3.2
  │ │ ├── lodash._arraycopy@3.0.0
  │ │ ├── lodash._arrayeach@3.0.0
  │ │ ├─┬ lodash._createassigner@3.1.1
  │ │ │ ├── lodash._bindcallback@3.0.1
  │ │ │ ├── lodash._isiterateecall@3.0.9
  │ │ │ └── lodash.restparam@3.6.1
  │ │ ├── lodash._getnative@3.9.1
  │ │ ├── lodash.isarguments@3.0.4
  │ │ ├── lodash.isarray@3.0.4
  │ │ ├─┬ lodash.isplainobject@3.2.0
  │ │ │ └── lodash._basefor@3.0.2
  │ │ ├── lodash.istypedarray@3.0.2
  │ │ ├── lodash.keys@3.1.2
  │ │ ├── lodash.keysin@3.0.8
  │ │ └─┬ lodash.toplainobject@3.0.0
  │ │   └── lodash._basecopy@3.0.1
  │ └─┬ resp-modifier@4.0.4
  │   └── minimatch@2.0.10
  ├── immutable@3.7.5
  ├─┬ localtunnel@1.7.0
  │ ├── debug@0.7.4
  │ ├── openurl@1.1.0
  │ ├── request@2.11.4
  │ └─┬ yargs@3.15.0
  │   ├── camelcase@1.2.1
  │   ├─┬ cliui@2.1.0
  │   │ ├─┬ center-align@0.1.1
  │   │ │ └─┬ align-text@0.1.3
  │   │ │   └─┬ kind-of@2.0.1
  │   │ │     └── is-buffer@1.0.2
  │   │ ├── right-align@0.1.3
  │   │ └── wordwrap@0.0.2
  │   ├── decamelize@1.0.0
  │   └── window-size@0.1.2
  ├── lodash@3.10.1
  ├── longest@1.0.1
  ├─┬ meow@3.3.0
  │ ├─┬ camelcase-keys@1.0.0
  │ │ └── map-obj@1.0.1
  │ ├─┬ indent-string@1.2.2
  │ │ ├── get-stdin@4.0.1
  │ │ └─┬ repeating@1.1.3
  │ │   └─┬ is-finite@1.0.1
  │ │     └── number-is-nan@1.0.0
  │ ├── minimist@1.2.0
  │ └── object-assign@3.0.0
  ├── opn@2.0.1
  ├─┬ pad-left@1.0.2
  │ └── repeat-string@1.5.2
  ├─┬ portscanner@1.0.0
  │ └── async@0.1.15
  ├─┬ query-string@2.4.1
  │ └── strict-uri-encode@1.0.2
  ├─┬ resp-modifier@5.0.2
  │ └─┬ minimatch@2.0.10
  │   └─┬ brace-expansion@1.1.0
  │     ├── balanced-match@0.2.0
  │     └── concat-map@0.0.1
  ├─┬ serve-index@1.7.2
  │ ├─┬ accepts@1.2.12
  │ │ └── negotiator@0.5.3
  │ ├── batch@0.5.2
  │ ├── escape-html@1.0.2
  │ ├─┬ http-errors@1.3.1
  │ │ ├── inherits@2.0.1
  │ │ └── statuses@1.2.1
  │ └─┬ mime-types@2.1.6
  │   └── mime-db@1.18.0
  ├─┬ serve-static@1.10.0
  │ └─┬ send@0.13.0
  │   ├── depd@1.0.1
  │   ├── destroy@1.0.3
  │   ├── mime@1.3.4
  │   └── range-parser@1.0.2
  ├─┬ socket.io@1.3.6
  │ ├─┬ debug@2.1.0
  │ │ └── ms@0.6.2
  │ ├─┬ engine.io@1.5.2
  │ │ ├── base64id@0.1.0
  │ │ ├─┬ debug@1.0.3
  │ │ │ └── ms@0.6.2
  │ │ ├─┬ engine.io-parser@1.2.1
  │ │ │ ├── after@0.8.1
  │ │ │ ├── arraybuffer.slice@0.0.6
  │ │ │ ├── base64-arraybuffer@0.1.2
  │ │ │ ├── blob@0.0.2
  │ │ │ ├── has-binary@0.1.5
  │ │ │ └── utf8@2.0.0
  │ │ └─┬ ws@0.7.2
  │ │   ├─┬ bufferutil@1.1.0
  │ │   │ ├── bindings@1.2.1
  │ │   │ └── nan@1.8.4
  │ │   ├── options@0.0.6
  │ │   ├── ultron@1.0.2
  │ │   └── utf-8-validate@1.1.0
  │ ├─┬ has-binary-data@0.1.3
  │ │ └── isarray@0.0.1
  │ ├─┬ socket.io-adapter@0.3.1
  │ │ ├─┬ debug@1.0.2
  │ │ │ └── ms@0.6.2
  │ │ ├── object-keys@1.0.1
  │ │ └─┬ socket.io-parser@2.2.2
  │ │   └── debug@0.7.4
  │ ├─┬ socket.io-client@1.3.6
  │ │ ├── backo2@1.0.2
  │ │ ├── component-bind@1.0.0
  │ │ ├── component-emitter@1.1.2
  │ │ ├── debug@0.7.4
  │ │ ├─┬ engine.io-client@1.5.2
  │ │ │ ├── component-inherit@0.0.3
  │ │ │ ├─┬ debug@1.0.4
  │ │ │ │ └── ms@0.6.2
  │ │ │ ├─┬ has-cors@1.0.3
  │ │ │ │ └── global@2.0.1
  │ │ │ ├── parsejson@0.0.1
  │ │ │ ├── parseqs@0.0.2
  │ │ │ ├── parseuri@0.0.4
  │ │ │ └── xmlhttprequest@1.5.0
  │ │ ├── has-binary@0.1.6
  │ │ ├── indexof@0.0.1
  │ │ ├── object-component@0.0.3
  │ │ ├─┬ parseuri@0.0.2
  │ │ │ └─┬ better-assert@1.0.2
  │ │ │   └── callsite@1.0.0
  │ │ └── to-array@0.1.3
  │ └─┬ socket.io-parser@2.2.4
  │   ├── benchmark@1.0.0
  │   ├── debug@0.7.4
  │   └── json3@3.2.6
  ├── ua-parser-js@0.7.9
  └── ucfirst@0.0.1

@af7 If you can't install SDK 7.1 full, use VS 2013/2015. With this warning SDK not install C++ compilers that we need to compile.

I created a profile in Windows 7 x64 with RU letters, digits, etc: артем_12312_() and installation failed (same v8.h error):
C:\Windows\system32>whoami
artyom-pc\артем_12312_()

C:\Windows\system32>npm i -g browser-sync
npm WARN install Couldn't install optional dependency: Unsupported
C:\nodejs\browser-sync -> C:\nodejs\node_modules\browser-sync\bin\browser-sync.j
s

> bufferutil@1.1.0 install C:\nodejs\node_modules\browser-sync\node_modules\buff
erutil
> node-gyp rebuild

C:\nodejs\node_modules\browser-sync\node_modules\bufferutil>if not defined npm_c
onfig_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo
dules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Построение проектов в этом решении по одному. Чтобы включить параллельное постро
ение, добавьте параметр "/m".
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Cannot open include file: 'v8.h': N
o such file or directory [C:\nodejs\node_modules\browser-sync\node_modules\buff
erutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modul
es\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074
:12)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\nodejs\node_modules\browser-sync\node_modules\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON C:\nodejs No description
npm WARN EPACKAGEJSON C:\nodejs No repository field.
npm WARN EPACKAGEJSON C:\nodejs No README data
npm WARN EPACKAGEJSON C:\nodejs No license field.
npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "i" "-g" "browser-sync"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Windows\system32\npm-debug.log

C:\Windows\system32>

But artyom_000 username works =)
Also SO question about SDK installation erro created:
https://stackoverflow.com/questions/32423090/cant-install-windows-7-sdk-require-already-installed-net-framework-4

Found solution for Windows 7, Windows 8 and Windows 10. Tested on clean x64 installations. Visual Studio not required.
You need only these tools:

Node.js v 0.12.7
npm 3.2.0 or higher
Python 2.7.9
SDK for Windows 7 (no need SP1, in most situations all works without it)

Steps:

If you profile contains non-ASCII characters, rename it or create the other one.
Install Node. I use C:\nodejs folder.
Update npm from 2.* to 3.*:

npm i -g npm@3.2.2
cd C:\nodejs
npm i npm@3.2.2
npm -v (must be 3.2.2)

Install python 2.7.9 and choose add to PATH in installation. After install python command in console should work. If not, reboot your PC.
Download and install [Windows SDK 7] (https://www.microsoft.com/en-us/download/details.aspx?id=8442). Choose GRMSDKX_EN_DVD.iso for x64 and GRMSDK_EN_DVD.iso for x86. All checkboxes by default.
If you see error Some components cannot be installed (especially on Windows 10), install SDK from Setup/SDKSetup.exe. [More info] (https://stackoverflow.com/questions/32423090/cant-install-windows-7-sdk-require-already-installed-net-framework-4).
Use SDK 7.1 console for node modules installation.
That's all.

It would be nice if somebody helps me with PATH variables to use native command prompt.

awesome!
On Mon, Sep 7, 2015 at 6:41 AM, Artyom Mezin notifications@github.com
wrote:

Found solution for Windows 7, Windows 8 and Windows 10. Tested on clean
x64 installations. Visual Studio not required.
You need only these tools:

Node.js v 0.12.7
npm 3.2.0 or higher
Python 2.7.9
SDK for Windows 7 (no need SP1, in most situations all works without
it)

Steps:

If you profile contains non-ASCII characters, rename it or create the
other one.

Install Node. I use C:\nodejs folder.

Update npm from 2.* to 3.*:

npm i -g npm@3.2.2
cd C:\nodejs
npm i npm@3.2.2
npm -v (must be 3.2.2)
Install python 2.7.9 and choose add to PATH in installation. After
install python command in console should work. If not, reboot your PC.
Download and install Windows SDK 7
https://www.microsoft.com/en-us/download/details.aspx?id=8442.
Choose GRMSDKX_EN_DVD.iso for x64 and GRMSDK_EN_DVD.iso for x86. All
checkboxes by default. If you see error Some components cannot be
installed (especially on Windows 10), install SDK from
Setup/SDKSetup.exe. More info
https://stackoverflow.com/questions/32423090/cant-install-windows-7-sdk-require-already-installed-net-framework-4
.
Use SDK 7.1 console for node modules installation. That's all.

It would be nice if somebody helps me with PATH variables to use native
command prompt.
—
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node-gyp/issues/629#issuecomment-138276692.

@Sogl, thanks for the steps!

It would be nice if somebody helps me with PATH variables to use native command prompt.

To have MSBuild that installs with VS2015, you may want to add %ProgramFiles(x86)%\MSbuild\14.0\Bin to PATH.
In case you have multiple versions of VS installed, you can explicitly specify VS2013's MSBuild (when VS2015 is in PATH), use %ProgramFiles(x86)%\MSbuild\12.0\Bin\MSBuild build\solution_name.sln or its PowerShell variant ${env:ProgramFiles(x86)}/MSBuild/12.0/Bin/MSBuild build/solution_name.sln. I know fingers hurt typing it everytime, but I am used to it now. :)

Here's my solution. Hope it can help someone.
After wasting two evenings of own free time staring at the same error in a PowerShell window
gyp ERR! stack     at ChildProcess.onExit (C:\ProgramFiles\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)

this morning I went working from an old-fashioned CMD window as administrator, and magically it all worked just fine.
I am using VS 2015 with all the C++ jazz, no special packages and the
GYP_MSVS_VERSION=2015

variable set from the control panel, just like fifteen years ago.
This is the crappiest situation I've met in the last couple of years.

Working Solution on Windows 10
Can confirm @marco-faustinelli is right. I'm using Windows 10:

Installed VS 2015 Community with C++ Project Support.
Installed Python 2.7 binary and added it to to my PATH.
Added a System Variable GYP_MSVS_VERSION=2015.

At long last, I was able to npm install -g socket.io from an elevated CMD prompt and install socket.io.

@vanflymen , In your solution we need to download ~4 GB VS2015 and install it only for build cpp files...
[My solution] (https://github.com/nodejs/node-gyp/issues/629#issuecomment-138276692) is better I think.

@Sogl That solution works great (Thank you!) if you don't have to integrate it into an environment where other versions of visual studio are in active use and are ok with always using the SDK command prompt
@marco-faustinelli @vanflymen Does that solution bypass the requirement for the Windows 7.1 SDK, and does it work on other Windows versions? (7/8/8.1)

I did a clean format of Windows 10, installed Python 2.7.10 and the newly released nodejs v4.0.0 and everything seems like it works. node-gyp is finally working too.
I still can't install socket.io but it looks like some dependencies haven't been updated yet.

Maybe that has to do with the new bundling of node-gyp into node 4.0.0?
"node-gyp: This release bundles an updated version of node-gyp that works with all versions of Node.js and io.js including nightly and release candidate builds. From io.js v3 and Node.js v4 onward, it will only download a headers tarball when building addons rather than the entire source."

Haven't tried it yet myself.

Sorry to see all this frustration with using node-gyp on Windows :unamused:
While it might take some time to implement, we are pursuing a solution that will eliminate the need to have VS installed when installing native modules: https://github.com/nodejs/build/issues/151

awesome @orangemocha. I'm glad someone is looking at this!

I just want to say... this is hell. I've installed several things trying to fix it, about to roll back to a safer system restore to try some more things. But seriously....

OK, so here's how I fixed the issue and got node-gyp building with Visual Studio 2015 installed.

Be on version 0.12.2. This breaks completely on 4.0. However, v0.12.2 is what the the Visual Studio 2015 installer will install if you ask it to install Node.js.
Make sure the C++ components of Visual Studio 2015 are installed. If you're not sure run the installer and check.
Update NPM using npm-windows-update.
And it worked! I didn't have to install the SDK, but I did make sure I checked to install the C++ comp

@Pharylon Lucky you. npm-windows-update just hosed my system: https://github.com/felixrieseberg/npm-windows-upgrade/issues/34

Since upgrading to node4 with node-gyp v3.0.3 I'm having even more issues than before.  Packages that previously installed ok are now failing.  Really sick of this TBH.

@bgSosh same for me! now trying to figure out how to go back.

Just shoot me!

@dperu BANG!!!   You're confusing Node.js with NPM with node-gyp. This issue has nothing to do with node and everything to do with how developers are creating their modules; using platform-specific approaches and existing code-bases that have to be compiled. node-gyp is a tool they use to help automate that process (think tar-ball).
Sadly, too many developers don't use node as they should and then there are cases where they don't want to recreate (perhaps rightfully so) code in node.js that's already setup for something like c++ or another language and it has to be compiled. @TooTallNate (along with other developers/maintainers of node-gyp) have taken on quite the task in supporting those use-cases and really shouldn't be faulted. It's really up to the community to reduce their dependence on non-node solutions.
At least, that's my opinion based on what little I know :P Take it with a grain of salt.

@rainabba You are right, it's more a npm and node-gyp issue.   You are right.  I am actually thankful to the other developers who are making C++ contributions.  It's been 17 years since I've compiled a C++ program.  I'm coming from a C# background.  But at this point I am in the process of switching stacks.  I really like NodeJS and the JavaScript programming language.  This particular issue is frustrating thought but I imagine at some point I will be able to hack it out with all the blog posts.

@Sogl I like your minimal solution, but have you been able to get it to work with node4?

@Sogl This is how the problem started for me.  I was using node4 with node-gyp v3.0.3.  And I started loading older versions.  My current thinking on the problem is the PATH variable is not using the correct location for MSBUILD but I was busy at work and I did not get a chance to test it.  In the command prompt you can enter the command: "where msbuild" to see the path location.

So here is what I discovered.  I followed the other blog posts and installed Windows SDK 7.  When
I launch the SDK 7 command prompt having the "SetEnv.cmd" I still got errors.  Here is what I was
orginally trying to do from the command prompt:
C:\tmp4\npm install -g buffertools
But this failed miserablly.  Then after reading some posts I did the following:
C:\tmp4> git clone https://github.com/bnoordhuis/node-buffertools
C:\tmp4> cd node-buffertools
C:\tmp4\node-buffertools> node-gyp rebuild
This gave me some additional error information.  That information seem to indicate I was using
the wrong version of MSBUILD.  So I did the following:
C:\tmp4\node-buffertools> where msbuild
C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
I needed a version of SDK 7 which support the Framework\v4.0.30319.  But when I installed SDK 7.1 which
is supposed to support Framework\v4.0.30319 it did not create a "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin"
folder as I would expect.  Even the installer said it would create the directory but it did not.  And I did
run the installer in Administrator mode.
So my next step was to launch the 7.0 command prompt and change the PATH.  Here's the 7.0 command prompt:
C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd"
I created a desktop icon for this, and then right-clicked and selected "Run as administrator" from the popup menu.
I did the following command from the command prompt:
C:\tmp4> set PATH=C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v4.0.30319;%PATH%
Then I was able to do all the following:
C:\tmp4> cd node-buffertools
C:\tmp4\node-buffertools> node-gyp rebuild
C:\tmp4\npm install -g buffertools
C:\tmp4\npm install -g strongloop			// My original intention of my efforts!   Success!
One little gotcha when I got started.  After you install NodeJS, you should edit the following file:
C:\Program Files\nodejs\node_modules\npm\npmrc
Change the following:
prefix=%APPDATA%\npm
To the following (or some other appropriate location):
prefix=c:\NodeJS_npm
Then I put the directory "c:\NodeJS_npm" in my PATH so the installed node modules can execute.
So this command now works:
C:\tmp4> slc loopback

IMO, doWhich function should be removed and its usage should be replaced by findMsbuild().
findMsbuild always attempts to get the latest ToolsVersion installed first, instead of selecting the one present in the PATH; which in some cases corresponds to older version. It certainly depends on the combination of installed software, for instance; it is happening in my setup very often where I normally only install a latest VS but some other runtimes setup installs old VS redistribution packs (vs2013 etc.) as well as "partial MSBuild" (v12.0 with no supporting VC libs and 14.0 targets support) installation. Currently in my setup, PATH in Git for Windows PowerShell instance suggests:
# in PowerShell
C:\> (gcm msbuild).Version          # see http://stackoverflow.com/a/32522462/863980

Major  Minor  Build  Revision
-----  -----  -----  --------
12     0      31010  0

# (now I have manually set PATH to %ProgramFiles(x86)\MSbuild\14.0\Bin% in System >
# Environment Variables settings)

This change might result in performance degradation by few [milli]seconds per build, but I think it is important for correctness.
Alternatively, perhaps make the doWhich OR findMSBuild function selection optional controlled by an additional environment variable knob like $env:GYP_USE_LATEST_MSBULD=1.

@orangemocha,
Does it also eliminate the need for Python?
I'm quite new to Node, and it seems crazy to me that I have to build things that are installed via packages.

@bgSosh I haven't tried node 4 installation, but so sad to hear that problems remain.

Does it also eliminate the need for Python?

It would be good to eliminate that dependency too. Ideally you'd just need what comes with the Node installer (Node.exe + npm) and then npm install would just work.

Not only does it require Python, it requires Python 2. But, I mean, Python 3 has only been out for seven years. I guess it's too soon to expect that to be supported. :\

https://code.google.com/p/gyp/issues/detail?id=36&q=python 3
Until gyp itself has Python 3 support, node-gyp is stuck with the Python 2 requirement

Hey everyone, just a quick update on things from the Microsoft end of things. This thread has made its rounds amongst the product teams, and is high on people's radar. I also spoke with the C++ team, and they want to help, but we're still investigating, so we can't make any promises just yet.
There are two key issues at play here:

It's not entirely clear which specific components are required: Currently we're trying to figure out a set of minimal dependencies required - what headers, libraries, versions, targets files, etc. It would also be helpful to get a set of npm packages that should work so we can ensure we don't miss anything. If anyone has deeper context on this, then lmk - it would be great to run things by you. (@orangemocha let's sync up since it seems you're also diving into this?)

We need a way to bundle these components into a single install: That may take more or less time depending on what teams need to be involved (see *#*1), but as alluded to above - just about everyone I've connected with here agrees that downloading full VS is not a reasonable expectation, and wants to do something about the problem. There is also some good biz justification from Azure because it would make their provisioning process easier.

Anyways... I know it still feels like all talk right now, but hopefully things'll get more concrete as we continue to investigate. :smiley:

Thank you @mousetraps! Really. It's great to know that this is being talked internally at MS. Please keep us posted!

@mousetraps,
Binary compatibility is a key challenge on all platforms for any node.js package with native module. For instance, to have binary working on "most" of the Linux distributions, we build on old CentOS 5. For FreeBSD, the one built on v10, does not work on FreeBSD 8. Same the case with OSX. On Windows XP-10 compatible binary can be built on 10 with VS2015, which is great deal IMVHO.
Binary distribution is another challenge: as there is no uniform way of distributing binaries. Some packages are distributing via GitHub repos and some are using cloud services (S3 buckets), but both kinds are providing a fallback option to build from source during the installation. There are even some packages that do not provide prebuild binaries at all and encourage only building from source on install. There starts the Windows specific problem due to the lack of OOTB C/C++ compiler. Other OSes don't have this challenge as C/C++, Python, Ruby etc. runtimes come preinstalled in most Unices.

We need a way to bundle these components into a single install

IMO, this experience can be much improved if we only get OTTB C/C++ compiler in Windows clients, as well as the ability to install or in-place upgrade standalone C++ build toolchain: VC compilers + libraries + dependencies (these are C/C++ build-tools related dependencies, not Python etc.), all this to match the degree of Clang/GCC readiness and availability on Unices.
Current requirements to install packages with native modules after fresh Windows installation:
Visual Studio + Python 2.7.x + Node.js
Most Desired behavior:
Standalone Build Tools + Pythons 2.7.x + Node.js
(and ability to install everything via command-line, perhaps via: https://chocolatey.org/)
Maybe Desired Behavior:
One magic box for all node.js build tools. Or a one-click web-installer, which will let users choose which runtimes are required.

set of npm packages that should work so we can ensure we don't miss anything

Here is a small list of commonly used packages with native module, which cover most of the nan surface area:

bson
bufferutil
kerberos
node-sass
node_sqlite3
phantomjs
utf-8-validate

Most Desired behavior:
Standalone Build Tools + Pythons 2.7.x + Node.js

Most desired behavior for whom? Most desired behavior for package users should be "it just works", and for this a web service that builds, caches, and serves binaries makes the most sense (which I think is what is described here).
If you actually want to build from source yourself, then it's okay to have those requirements (although Python 2.7 is ancient), but not everyone wants/needs to do this.

I don't know if anything has changed in the last week or so, but I seem to have gotten everything working fine under the latest Node and NPM versions with a brand new Window 7 x64 Ultimate install in Virtualbox.
Unless I missed something all I did was install:
Node 4.1.1
NPM v3.3.5 (updated using npm-windows-upgrade)
Git 2.5.3.windows.1
Python 2.7.10
Visual Studio 2015 Community
ConEmu (shell wrapper for various consoles)
At that point I was able to npm install a project with dependencies including webpack, webpack-dev-server, gulp, etc and I could see node-gyp building successfully.
I never had to set any environment variables or make any other special configurations.  Not that it should matter, but I am using ConEmu with the Git Bash shell for most things.  Modules that were installed globally (thus requiring administrative privileges) were installed using a standard CMD console with elevated privileges.

For the following error
C:\Development\GitHub\flux (master)
λ npm i
npm WARN engine jest-cli@0.1.18: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"3.2.2"})

> contextify@0.1.14 install C:\Development\GitHub\flux\node_modules\contextify
> node-gyp rebuild

C:\Development\GitHub\flux\node_modules\contextify {git}
{lamb} if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Development\GitHub\flux\node_modules\contextify\build\contextify.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files(x86)\MSBulid\Microsoft.Cpp\v4.0\v140\Microsoft.Cpp.Default.props" was not found. Confirm that the pa th in the <Import> declaration is correct, and that the file exists on disk.

Per @ProtomotoReal, all I had to do was SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
Hopefully this helps someone.

For Windows 10 + VS2013 Ultimate - npm install was throwing this error:
F:\git\Coding\NasaDashboard\nasa-web-app\node_modules\kerberos>if not defined npm_config_node_gyp (node "C:\Users\Gosha\AppData\Roaming\npm
node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Plat
form Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and
then select "Update VC++ Projects...". Install v120 to build using the v120 build tools. [F:\git\Coding\NasaDashboard\nasa-web-app\node_mo
dules\kerberos\build\kerberos.vcxproj]
The suggested solution from @ProtomotoReal worked for me. In my NodeJS command prompt I ran

SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120

Then npm install worked fine:
F:\git\Coding\NasaDashboard\nasa-web-app\node_modules\kerberos>if not defined npm_config_node_gyp (node "C:\Users\Gosha\AppData\Roaming\npm
node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
kerberos.cc
worker.cc
security_buffer.cc
security_buffer_descriptor.cc
security_context.cc
security_credentials.cc
base64.c
kerberos_sspi.c
win_delay_load_hook.c
Creating library F:\git\Coding\NasaDashboard\nasa-web-app\node_modules\kerberos\build\Release\kerberos.lib and object F:\git\Coding\Na
saDashboard\nasa-web-app\node_modules\kerberos\build\Release\kerberos.exp
Generating code
Finished generating code
kerberos.vcxproj -> F:\git\Coding\NasaDashboard\nasa-web-app\node_modules\kerberos\build\Release\kerberos.node

+1 node-gyp is a real pain in the ass for Windows user. For instance if you want to do security you'll need bcrypt and so node-gyp so install a 2go IDE.

Why NodeJS Core didn't include node-gym in it's core ? It's already platform dependent
Why not providing (with Microsoft Help) a wrapper to install on Windows ?

Why NodeJS Core didn't include node-gym in it's core ? It's already platform dependent

Assuming you meant "node-gyp". It is included with every installation of Node.js (as an npm dependency).
The problem is that you also need Python and Visual Studio. We (a few folks at Microsoft) are working to tackle this issue.

node-gym :grey_exclamation:
Is it someplace where all the node'ies do the exercise? :smile:

Sorry for the typo.
That would be SOOOO cool if a workaround allow a simple native npm install module
It will still require an install, but it's a great step

:+1:  for this. All operating systems (mac, linux) have build tools usable in this case free for both for private and commercial use, except of Windows. Now, to use node-sass, I have to install visual studio which is free only for private use.
Minimum requirement for this is: a package which installs compilers, linkers, etc ... - without any additional components. Just SDK with tools used to build a binary addon.
I don't know, maybe Windows SDK is suitable but I haven't any manual how to set it up with node4.

@antelle I'm absolutely for a minimal set of requirements and hope that Microsoft makes it much easier.  That being said, Visual Studio Community edition is free for commercial use provided that your company is small (under $1 million in revenue and/or more than 250 PCs) and that 5 or fewer developers concurrently use the software.  So it is certainly free for an individual to use commercially.  In fact, if I'm reading the license right you could be the sole developer of some software (with no help) and still qualify for a free license even if you happen to bring in $1 million or more in annual revenue.
For open source or other non-commercial use it is free for anyone or any organization with no limitations.
Of course it would still be much better to have the basic compilers and build tools available as a continually supported Microsoft package to prevent the necessity of Visual Studio with its large footprint.

@dlong500, I work in a company, and we are not a small company. We develop a large commercial product: there are several C++ devs and plenty of front-end. We cannot use free visual studio, so the question is:
Why do we have to spend additional $5000 for every front-end dev if none of them will ever open visual studio? Windows SDK is free, and it does include C++ compiler, so requiring VS for node-gyp is just a nonsense.

@antelle, well yes if you are in a large company then it's not as simple.  However, if you are only using the cli compilers I'm not sure if the same licensing restrictions would apply.  Anyone from Microsoft willing to clarify?
Don't get me wrong, I completely agree with you as I said before.  The SDK should be all that is needed, but in the meantime it would seem appropriate if Microsoft would allow compilers installed with VS community to be restriction free if used outside of VS.

Windows SDK is free, and it does include C++ compiler, so requiring VS for node-gyp is just a nonsense.

Wrong, I'm afraid.  From https://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx:

The Windows SDK no longer ships with a complete command-line build environment. You must install a compiler and build environment separately. If you require a complete development environment that includes compilers and a build environment, you can download Visual Studio 2013, which includes the appropriate components of the Windows SDK.

@dlong500 : you can use Visual Studio Express for Windows Desktop.
From https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx

Commercial use of Express products
Visual Studio Express products are available at no charge and may be used for commercial, production usage subject to the license terms provided with each product. For example, you can use Express for Windows to create apps that you can then submit for sale in the Windows Store.

@bnoordhuis, thanks for the link. I was pretty sure it was still distributed with SDK (and is actually was used to be included before) but that is no longer true. Also  found this question on stackoverflow. Yes, it seems, there's no way to get a free C++ compiler.
So this means, that we cannot use node-sass? Really bad.

@joncaves, unfortunately you seems to be the only person from VC team on GitHub, therefore I am pining you. Apologies in advance! :)
Since this is one of the attention drawing hot topic these days and VC team or (despite their tremendous work in at least past 5 years) getting bad PR etc. can any of the bosses or bosses-like entities form VC team @Microsoft can chime in here  and provide any kind of reassurances for native lib devs / build system folks? I would love to hear from Eric Battalio's, Jim Springfield's (and co) take on "having free C/C++ build-tools incl. SDK etc. on windows" matter.
Thanks in advance for listening!

@orangemocha, but does VS Express not have the same limitations for large organizations?  What are the "license terms provided with each product"?  Unless those terms are different than VS Community then it is a real shame there are no longer any truly free compilers from Microsoft for their own platform.

No problem: I am not (directly) involved in this work but I passed your email on to the people who are (including @mousetraps).
Thanks
JonCaves
On Wed, Oct 7, 2015 at 1:43 PM -0700, "Peter Jas" <notifications@github.commailto:notifications@github.com> wrote:
@joncaveshttps://github.com/joncaves, unfortunately you seems to be the only person from VC team on GitHub, therefore I am pining you. Apologies in advance! :)
Since this is one of the attention drawing hot topic these days and VC team or (despite their tremendous work in at least past 5 years) getting bad PR etc. can any of the bosses or bosses-like entities form VC team @Microsofthttps://github.com/Microsoft can chime in here and provide any kind of reassurances for native lib devs / build system folks? I would love to hear from Eric Battalio's, Jim Springfield's (and co) take on "having free C/C++ build-tools incl. SDK etc. on windows" matter.
Thanks in advance for listening!

Reply to this email directly or view it on GitHubhttps://github.com/nodejs/node-gyp/issues/629#issuecomment-146321928.

@dlong500 The Express 2015 licensing doesn't appear to have the same verbiage regarding large organizations and whatnot. See the following links to license terms for more info:

VS Community 2015
VS Express 2015

There is also this licensing whitepaper that has some additional info:
http://www.microsoft.com/en-us/download/details.aspx?id=13350
That said... I'm an engineer, not a lawyer... so I can't do any more than post links to content that's already freely available. :smiley:

+1 to seeing this situation get better, I just lost a night to troubleshooting this

@dlong500, this has been confirmed by a member of the legal team at Microsoft: there’s no enterprise usage limitation in the VS Express EULA.

@orangemocha, thanks for clarification of VS Express EULA. So, I have tried VS Express 2015 and it's working ok on new virtual machine. Config which I was using: Windows 10, Visual Studio Express 2015 for desktop, Windows 10 SDK, nodejs 4.1.2, node-gyp 3.0.3, python 2.7.10, git 2.6.1.
I have added env. variable GYP_MSVS_VERSION=2015 and then executed npm config set msvs_version=2015.
Note: installing SDK is not optional; without it, compilation will fail with error Could not load the Visual C++ component "VCBuild.exe".

@orangemocha yes, thanks for the info.  The ideal solution would be a minimal build-tools package from Microsoft, but this is certainly a good workaround for now.

I am desperate now :-1:
I have reinstalled windows. Have now fresh Windows 7 + Windows 7.1 SDK + Latest Node and NPM + C++ Compiler for Python 2.7 and Python 2.7, but am getting myriads of errors on compile:
Example:
C:\Users\Tomi\.node-gyp\4.2.0\include\node\v8.h(3257): error C2270: 'GetBoundFu
nction' : modifiers not allowed on nonmember functions [C:\Projects\test\node_m
odules\utf-8-validate\build\validation.vcxproj]
C:\Users\Tomi\.node-gyp\4.2.0\include\node\v8.h(3259): error C2270: 'GetScriptO
rigin' : modifiers not allowed on nonmember functions [C:\Projects\test\node_mo
dules\utf-8-validate\build\validation.vcxproj]
C:\Users\Tomi\.node-gyp\4.2.0\include\node\v8.h(3263): error C2059: syntax erro
r : 'private' [C:\Projects\test\node_modules\utf-8-validate\build\validation.vc
xproj]
C:\Users\Tomi\.node-gyp\4.2.0\include\node\v8.h(3264): error C2059: syntax erro
r : ')' [C:\Projects\test\node_modules\utf-8-validate\build\validation.vcxproj]
C:\Users\Tomi\.node-gyp\4.2.0\include\node\v8.h(3273): error C2504: 'Object' :
base class undefined [C:\Projects\test\node_modules\utf-8-validate\build\valida
tion.vcxproj]
C:\Users\Tomi\.node-gyp\4.2.0\include\node\v8.h(3275): error C2504: 'Object' :
base class undefined [C:\Projects\test\node_modules\utf-8-validate\build\valida
tion.vcxproj]

Any idea? Thanks!

@tomitrescak It looks like Visual Studio Express 2015 for desktop (or VS Community) are the only way to get the C/C++ build tools

I'd love to ditch windows on my development pc, and just use ubuntu for everything. So I have a (possibly dumb) question: Is it at all possible to build the .node native extensions for windows, using a linux machine?

One way of dev life is to bash MS/VS/Windows on GitHub every possible chance you get and achieve nothing but more spite. The other approach is to report the issue where it belong:http://blogs.msdn.com/b/visualstudio/archive/2015/10/08/visual-studio-2015-update-1-ctp.aspx#10647152 or on Microsoft Connect etc., which will definitely make a real impact. Point being, instead of getting desperate yourself, give THEM the bug and get the tech improved for the welfare of future of tech and mankind!

@jasonwilliams200OK . That's not very helpful.  Rest assured that many people on this thread have tried to go the official routes with MS.  We have jobs to do, and are simply looking for practical solutions to these problems that wont take months (or worse).

@bgSosh, yes exactly trolling is not helpful, but reporting the issue definitely is. Besides, this is not a today's problem and specific to node.js runtime. People are asking for isolated buildtools for many years, way before the existence of node.js and even v8. So if it is going to happen in few "months", then it would be a great deal. But I am not crossing my fingers for months timeline just yet, unless we get some concrete plan.

Is it at all possible to build the .node native extensions for windows, using a linux machine?

Not at the moment but it might be once clang++ / clang-cl gets ABI-compatible enough with MSVS.  It's possible 3.7 is already good enough for everyday use but I haven't tested that.

@bnoordhuis - Thank you! I'll check it out.

I just had the problem again with this command:
d:\tmp> npm install mongoose --save
This fixed it:
C:\tmp4> set PATH=C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v4.0.30319;%PATH%

I came into this problem using ionic, and in it's docs http://ionicframework.com/docs/guide/installation.html, it recommends:
If you are on Windows, make sure to download and install Git for Windows and optionally Console2. You will be executing any commands in this guide in the Git Bash or Console2 windows.

12GB. Do I have to download 12GB of Microsoft garbage to contribute 20 lines of code to a Javascript project?
This all make sense, does it not?

do I really have to plague my PC with MS stuff..

Sounds like you are using Unix-like operating system, then you don't need VS tooling at all to build the "node.js project only the one with native module".

Jason: no, I'm using Windows (long story), but still I get the chicken pox anytime I touch any of their development tools... I would have been OK with a few gigs of this that I can just ditch the moment my pull req. gets approved / but having to wait hours to just get another myriad of error messages is not even half funny,  and even would not be funny with the Benny Hills theme looped all the way.

First - if you have vs2015 but did a "typical" install (which does not install c++ stuff), you can install the c++ stuff by going File > New Project and trying to start a c++ project. You will get options to install things!
Second - I think there's lots of confusion overall. Can someone involved with node-gyp write up a blog post summarizing what the problem actually is? Things I'd like to see addressed

What exactly is the service that node-gyp provides that sooo many projects depend on?
Why on earth is a c++ compiler even necessary? Hardly anything else on windows requires a c++ compiler after all.
Why can't we just download a compiler as part of node on windows? Or as part of the first node-gyp install?
What does any of this have to do with Python?
Why is it a version of Python that was superseded over seven years ago?
What about all this is easier on a *nix system than on Windows?

I'm largely a javascript and .net developer. I've had some experience with a half dozen other languages including Erlang, Ruby, Java, and others, but never anything serious with Python or C++ which is why this entire conversation is a mystery to me. In fact, any time I try to do anything on linux I generally start hitting c++ dependency walls. I'd really like to understand the underlying issues that are causing problems on Windows.

@togakangaroo
I agree that a blog post detailing the issues at hand could be useful, but a little bit of research can answer all of your questions.
What exactly is the service that node-gyp provides that sooo many projects depend on?
It provides the ability to pull in natively compiled modules in to be accessible to Node.js. I.e. build C++ projects so you can use them in js.
Why on earth is a c++ compiler even necessary? Hardly anything else on windows requires a c++ compiler after all.
Because it is building native code, i.e. C++, which is super easy to do on non-Windows platforms with gcc or clang.
Why can't we just download a compiler as part of node on windows? Or as part of the first node-gyp install?
Just downloading a stand-alone compiler is one of the things that the multiple Microsoft employee posts in this thread have talked about, it is not easy to do, and less easy since they have removed the basic compiler from the latest versions of the Windows SDK.
What's the deal with the various configurations (an env variable and an npm variable? why?)
Because building c++ outside of a sandbox has many, many configurations and relies on envars that can drastically affect what is build.
How is it that there is such a large range of things that might go wrong? It would seem like there would be just two or three things but there seems to be endless combinations.
Welcome to compiling native code on a complex platform.
What does any of this have to do with Python? What is python even being used for?
Python is used internally by GYP, the CMake-like build system that node-gyp wraps and makes easier to use for node.
Why is it a version of Python that was superseded over seven years ago?
The reason python2 is required is because GYP requires it and hasn't converted to using python3. It isn't a simple switch to take a large project that many other projects depend on and change from Python 2 to 3, and so far, it doesn't seem like a large effort has been made to make that change, considering it is a low priority defect since 2009, https://code.google.com/p/gyp/issues/detail?id=36
*What about all this is easier on a nix system than on Windows?
*nix systems are a lot less complicated, you can very easily pull all your requirements (like gcc, python2, platform specific SDKS) and build and go, but on Windows, the ecosystem is a lot different, and it just isn't that simple, though many efforts, npm included, have tried to help this a ton, but there is still a lot of legacy work out there, and not enough time, money, and resources to turn it on overnight

Damn @dekarguy. That's a great explanation! I'll link this in the original question.

Why on earth is a c++ compiler even necessary?

For distribution, it is developer's choice whether they require end terminal to have C/C++ compilers available. For example in node-sass, we prebuild binaries and serve them from GitHub release assets. That is a too much work for repo maintainers; as for every module version (which roughly changes with every major version of node and used to change with every minor version before), there needs to be a different binary. This requirement is imposed by node.js runtime and there exist proposals to make the overall situation better (https://github.com/nodejs/node-gyp/issues/629#issuecomment-105072235).
Then we have different architectures and OSes. So the equation looks like <number of OSes to support> x <number of architectures to support> x <number of module versions to support>. There exist solutions like node-pre-gyp to automate this process. However, in node-sass we use a custom recipe to leverage AppVeyor CI to build binaries for Windows and store them as build artifacts. Hence as package devs, we don't even need a windows machine, we just download all combinations of windows binaries from AppVeyor once the release build succeeds. :)
Moreover, we backup our binaries in a separate repo: https://github.com/sass/node-sass-binaries. So we have 14 binaries for Windows, 14 for Linux, 14 FreeBSD and 7 (universal binaries) for OS X per release. And we will incorporate ARM at some point (and there is a news that MIPS is regaining popularity?). Anyhow, as a fallback (if the binary is not compatible for some astoundingly evil reason), then we do require C[++] compilers on end terminal.
Unless we have some kind of de facto solution/service for building and serving binaries (supporting BSDs and Solaris etc. obscure OSes and multi-architectures including ARM too), every npm package maintainer with native modules would either:

virtually create their own mini package manger to host the binaries

or

simply mark C[++] compilers as prerequisite to install their package (and do sometime more productive with their time). :smile:

It could be offtopic but...
I had the problem because I had two instances of npm installed.
Command where npm returned two different directorties. So I removed the topmost and ran npm i -g node-gyp or  for example npm i -g browser-sync.

@am11 so what I don't understand is  - that unlike linux, I cannot think of a single piece of windows software outside of node that requires compiling from source. This includes many open source cross-platform pieces of software. This includes packages that I myself maintain over nuget. I understand that those authors simply offer a pre-built executable but there isn't this matrix problem that you describe. There's at most 2 versions x86 and x64 and the former usually works fine.
So why is it that node and specifically node package maintainers insist on compiling from source? As you say, node-sass seems to do this. What is it about node that requires re-compilation with every single node version bump? How is this unlike nearly every other piece of windows programming?

@togakangaroo - You're not just compiling against win32/64, but also the node version - there are many possible combinations, so maintaining prebuilt binaries would not be practical.

@bgSosh forgive my C-ignorance. so does that bascially mean that the interop happens within the c program itself and not by just shelling out to an exe?
If that's the case, then in theory this would be easily solved by having anything that could possibly be accomplished by shelling out to an executable (node-sass is a great example) do so, right?
I'm just trying to understand. If the latter is true then there might be a class of dependencies that could potentially have node-gyp removed as a sub-dependency/

@togakangaroo - I deleted my answer just after I posted it, as I'm far from an expert myself in this, and thought it would be better answered by someone more knowledgeable.

@togakangaroo, the recompilation is required for all OSes. When the module version (which we can get from NODE_MODULE_VERSION in C or node -p process.version.modules in CLI) changes, it signifies the breaking change and loses the binary compatibility with the pervious version. I do not know exactly what needs to be done in order to bring about version to version binary compatibility but with foreign function interface (FFI) or stable ABI contract with v8, it seems like the situation may get better.
To this mix, v8 version changes (which I think is the main source of this breakage) also influence compatibility across node.js runtime versions. This disparity is abstracted away with nan for native module devs (so devs do not have to keep adding #ifdefs in their code for each function signatures etc. change; when v8 guys decide to refactor some public interface).
Some information about this behaviour can be found in node.js docs: https://github.com/nodejs/node/blob/6fff47f/doc/releases.md#4-update-srcnode_versionh.
Folks over at node.js and libuv IRC channels and @kkoopa (who have done tremendous work on nan to keep us going) helped me understand all this, once upon a time. :)

Hey all, in case you missed it... :smiley:

Visual C++ Build Tools 2015 (Pre-release). If you want to build your C++ projects targeting Windows desktop without having Visual Studio installed on your computer, Microsoft Visual C++ Build Tools 2015 provides the required tools: C++ compilers, libraries, build scripts, Windows SDKs. This Community Technology Preview ships with the same C++ compilers and libraries packaged with Visual Studio 2015 Update 1 RC (2015.1).
http://blogs.msdn.com/b/vcblog/archive/2015/10/29/visual-studio-2015-update-1-rc-available.aspx

The config steps with Node.js should now be as follows:

Install VC++ Build Tools Technical Preview

:bulb: [Windows 7 only] requires .NET Framework 4.5.1

Install Python 2.7, and add it to your PATH, npm config set python python2.7
Launch cmd, npm config set msvs_version 2015 --global (this is instead of npm install [package name] --msvs_version=2015 every time.)
SO MUCH npm install :tada:

So please give it a spin and send feedback if  you're still running into issues or you think any crucial bits are missing. Much thanks to the VC team for pulling this off!! :smiley: +@mluparu
I've tested it with Node.js and many of the most popular / representative packages. This includes the following packages, as suggested by @am11.

bson
bufferutil
kerberos
node-sass
sqlite3
phantomjs
utf-8-validate

Note that there are still many other things that can go wrong when dealing with native modules - e.g.  platform and compiler differences, incompatibilities with architecture, Node version, missing prerequisites (and unfortunately most packages don't provide the best indication of how and where to get those prereqs). One tool that's very helpful in debugging missing prerequisites on Windows is Dependency Walker.
BTW I'll be in SF next week giving a talk on Node.js + Windows, so definitely swing by if you're in the area, and want to chat further: https://www.eventbrite.com/e/nodejs-and-npm-for-the-windows-developer-tickets-19280683042

@mousetraps Is it working on both node.js branches - 0.xx.x and 4.x.x? Which npm versions are tested?

Thank for the update @mousetraps! This is really an excellent news. I actually skimmed through that blog post, but somehow skipped the last bit. :smile:
With VS2015 Update 1 RTM, I hope we will have an ISO which we would be able to consume with Windows Nano Server and docker containers etc. :)
Currently, from the link you provided, when I downloaded VisualCppBuildTools_Full.exe and ran VisualCppBuildTools_Full.exe /layout (the download-only switch) from cmd, (it complied the default save path has invalid ++ characters, so I changed it to c:\temp\blah), it downloaded 1.38 GBs; which is large but comparatively much better than the VS installation.
@Sogl, per my understanding, if it compiles the package under question with one version of node.js, it should compile with all the versions that the package supports (the package maintainers need to keep their native binding up-to-date by depending on latest versions of node-gyp and nan, which sometimes take some code changes rather than mere version upgrade).

@mousetraps Any idea why can't I install Visual C++ Build Tools 2015 without uninstalling VC2015?

@fuczak i can't install it at-all.. even without the VS2015 installed. Luncher just showls the splash-screen and then dies.. sometimes Win10 wants to investigate the issue but then recommends to close the installer

@spawn-guy can you send the install logs? Run vscollect.exe from http://aka.ms/vscollect and share the %TEMP%\vslogs.zip, sharing it on OneDrive preferred.
Thanks!

then it downloaded 1.38 GBs; which is large but comparatively much better than the VS installation.

OMG. It would be better to give us a link to iso-image. Not all of us have a good Internet connection.
@mousetraps Thank you very much! All works fine with node 4.
My env:
Windows 7 x64
node 4.2.2
npm 3.3.12

Just tested with browser-sync and node-sass.

@mousetraps, It's working, thank you.

@mousetraps Works like a charm! Thanks you very much.
I spent few hours to figure out this problem and I'm sure you saved me many hours of investigation.
My env:
Windows 7 x64
node 5.0.0
npm 3.3.6

Tested with npm install:
serialport
phantomjs
browser-sync
node-sass

My experience of trying to use node.js on Windows 10, after following all the directions I can including those in this thread, is just a hailstorm of errors.
I have given up for now.
If Microsoft wants node.js to be part of its ecosystem it's going to need to do far reaching and comprehensive QA and simulate typical user scenarios.
Right now node.js on Windows is just a huge time waste.

@dukedougal, next time try horking these logs at gist.github.com please. You screwed up scrollbar size!

@dukedougal in this case, I'd expect the same issue would on any platform. In particular, you're trying to install node-sass@0.9.6, which is incompatible your current version of Node.js. You can tell because the errors you are getting involve syntax errors related to nan and the like. The most recent version of node-sass (3.4.1) should work fine with the latest releases of Node.js.

Thanks @am11 and @Sogl for the feedback on ISO distribution and the /layout flag! The VC team is looking into both issues.

@mousetraps I appreciate your help very much thank you but the point remains, whether the fault of Windows or not.
If I'm using the wrong version of something then I shouldn't be hit with a wave of cryptic compiler errors.
It may make sense to you that errors related to nan means that Im using the wrong version of node-sass but there's no way for me to reach that conclusion.
Computer programs should be able to work out if the wrong version of this is being used with the wrong version of that and either explain the problem and how to fix it or better yet, just fix it.
Landing in some sort of dependency/versioning hell seems to be characteristic of node.js and it's not something I see in other software ecosystems that I work with.
I haven't made any decisions along the way about which version of node-sass to use.  I have just followed instructions to install node and the compilers and then tried to npm install
It's a big help to know that the problem is something to do with node-sass version but all that does is give me a clue to drop back into the hell of working out exactly why this has happened and how to fix it. I'm still faced with software that doesn't work and I'm not relishing wasting my precious saturday just trying to work out how to get the correct version of node-sass somehow into this process.
node.js, until it fixes its versioning and dependency hell, is effectively completely broken.
Until node.js fixes the deep hell of versioning errors, it's immature and effectively completely broken.  I don't have hours and days available just to try to make the thing use the right version of something.

If I'm using the wrong version of something then I shouldn't be hit with a wave of cryptic compiler errors.

I agree. There is also literally no way to accurately tell this, as far as I can tell, and from what I've learned from others. :/

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v140 to build using the v140 build tools. [C:\COMPANYDATA\WEB\Public\BM\AZPREP-BM-1.4.0_20151106T0945\node_modules\xslt4node\node_modules\java\build\nodejavabridge_bindings.vcxproj]
While trying to npm install a new update, I got the above. Following this thread, I downloaded the RC from @mousetraps above, but when I to uninstall, it fails saying blocked (even tried to reboot just in case it was a previous install issue). Below is the last bit of the log file which I suspect has the answer (looks like it's saying either I need to have something else installed, making me wonder what the point was) or like one of the required downloads is failing during setup.
Any suggestions?
[042C:03C8][2015-11-06T11:12:06]i000: MUX:  Setup update feature is enabled. Evaluating conditions to determine whether to run setup update.
[042C:03C8][2015-11-06T11:12:06]i000: MUX:  Checking http://go.microsoft.com/fwlink/?LinkID=606891 for update.
[042C:03C8][2015-11-06T11:12:08]i000: MUX:  Failed to download the update xml file from http://go.microsoft.com/fwlink/?LinkID=606891 Setup will not be updated.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition '(CurrentOperation = "Install") OR (CurrentOperation = "Repair")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i000: MUX:  Stop Block: NoApplicableUpdates : Update 1 RC does not apply, or is blocked by another condition on your computer.
[042C:03C8][2015-11-06T11:12:08]i000: MUX:  Detect Completed
[042C:03C8][2015-11-06T11:12:08]i000: MUX:  Wait for View to be loaded
[042C:10A0][2015-11-06T11:12:08]i000: MUX:  Detect Completed, now create view
[042C:03C8][2015-11-06T11:12:09]i000: MUX:  View loaded
[042C:03C8][2015-11-06T11:12:09]i000: MUX:  Stop Block: NoApplicableUpdates : Update 1 RC does not apply, or is blocked by another condition on your computer.
[042C:03C8][2015-11-06T11:12:09]i000: MUX:  Go to Blocker page.
[042C:03C8][2015-11-06T11:12:09]i199: Detect complete, result: 0x0

@dukedougal, I agree with @mousetraps; yours is not a Windows-only issue. node-sass v0.9.6 is not supported for node.js v5 on any platform. During this one year period, we experienced eight node.js module versions updates. In fact, the first version that supported io.js (aka node.js v1.x) was node-sass v2.0.0. Please update to latest version of node-sass (v3.4.1) in order to get more runtime versions support, tons of features in node-sass itself as well as the best Sass language v3x support till date via latest libsass. :)
Since we cannot provide a forward compatibility in binary due to process.versions.modules changes with current infrastructure of node.js C++ modules, therefore, we fallback to manual build if the suitable readymade binary is not found. v2+ of node-sass was the first to provide this fallback to "compile at install-time" mechanism for the new/unknown version of node.js. Unfortunately, that functionality was never backported to node-sass v0x and v1x branches (mostly due to the entire rewrite of binding layer and overall divergence, sprinkled with some procrastination and lack of majority consumers' interest in older version; as 0.9.6 corresponds to obsolete version of libsass so there is no point to invest time there).
Whenever you encounter such a problem, you can always search existing issues in node-sass issue tracker and file a new one if it wasn't reported before. We also have channel on gitter and slack.

@mousetraps, thank you! With this pace, I am sure the higher consumer satisfaction level will be achieved pretty swiftly. :)

@am11 how do even update to the latest node-sass?  I haven't made any decisions along the way to even install it. I had thought it was controlled by package.json files or something? If I install it, won't I get node.js applications complaining because they want an earlier version?

@dukedougal, the node-sass API also changed between v0.9.6 and v3.4.1. You are right, you cannot just update the node-sass version in C:\Users\username\devel\rubix\package.json and expect it to work right away. You will need to make the call sites to node-sass API in your code (or if you are dependent on some node-sass downstream such as gulp-sass or grunt-sass, you will need to upgrade its version and save yourself from updating code every time node-sass API changes).
This is a sad fact of life, but I am sure you will find sufficient help from node-sass readme and existing to get your project upgraded against latest version of node-sass.

@dukedougal @Fishrock123 I agree that Windows or not, the user experience with native module compilation is pretty non-ideal, and luckily there are folks who are making steps towards a better experience with efforts like https://github.com/nodejs/build/issues/151
FWIW while testing the C++ Build Tools, I wrote a script that runs through a large set of native modules in the npm registry, tries to build them, and saves some info about them like std, stderr, etc. (I haven't gotten the chance to push the script / results to GH yet, but I'll post here when I do). After running through the script, I started noticing some patterns, and have begun being able to establish a set of common errors, and am working on translating those errors into a more human and actionable language. Granted, it won't be perfect or precise, but hopefully we can use the results of that to provide more actionable errors during build so that people aren't left wading through cryptic compiler errors.

@mousetraps That sounds like very valuable efforts that will be greatly appreciated at a human level. I love Node.js (LONG time MS shop and came over from .net early 2014) and for the most part, it's an absolute pleasure to work with, but many of these (of MS specific issues) leave me scared I've taken multiple companies in the wrong direction because of something as simple as an error that provides no information and NPM installs are nearly always the source and from there, it seems nearly always a node-gyp compilation issue so work that that and what this thread addresses, stands to make the entire node.js experience substantially better and less frightening :)

@rainabba I'm just visiting from the Linux world and it was there that I established my belief that node.js has a major problem with versioning, builds and incompatibility.  node.js is a very long way from sunshine and lollipops on non-Windows platforms.

@mousetraps I followed your solution to the letter but now when I try npm install mongoose, I get the following error:
if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 15, in <module>
    import gyp
ImportError: No module named gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\dev\Pluralsight\Web Development with ExpressJS\node_modules\kerberos
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

I've tried re-installing node, putting it in a directory other than Program Files (to avoid a folder name with a space), updating npm, it always gives the same error. Searching for the error isn't particularly helpful because all the solutions given are how to fix a V8 build.

@mousetraps Thank you! It works and makes things so much easier.
Tested on Windows 10 x64, Node.js 5.0.0, npm 3.3.6
Successfully installed latest versions of:
selenium-webdriver
utf-8-validate
node-sass
phantomjs
bufferutil

+1000000000000000000000000000000000000

+1
I have Nodejs 5.0.0 x64, npm 3.3.6 and Win 8.1 x64. Should I try going with Win 10? I already tried lost of possible combiantions of VS, Python & node to make this work. But I obviously never succeeded...

Hi. Installed the Build Tools 2015 provided by @mousetraps, followed instructions, tried to install selenium-webdriver (node-gyp dependant) and got the error below. Any ideas? (nodejs 4.2.2, npm 3.4, windows 10x64)
Thank you!
C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Users\rickm\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid versio
n number. [C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate\build\validat
ion.vcxproj]
validation.cc
c:\users\rickm.node-gyp\4.2.2\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No
such file or directory [C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate
\build\validation.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\rickm\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\rickm\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: node-gyp rebuild
npm WARN install:utf-8-validate@1.2.1 Exit status 1

Update: I've gotten @mousetraps 's solution here to work on fresh installs of Windows 7 and 8.1 (both 64-bit machines). If you use node v5.0.0, it already comes with npm v3.3.6, which means you don't need to update npm.

@ricmed205 try to update to the latest npm. If does not help try the latest Node.js
I have tested selenium-webdriver. Should be installing fine.

I try  @mousetraps 's solution with windows 10 64 bit . Node 0.10.25 , npm 1.3.5 . but it not work

@phthong

but it not work

What didn't work? Which package is failing for you? What is the error you are getting?
@ricmed205, I tried installing selenium-webdriver with node.js 5 and it went well. According to google results, the error you are getting (Cannot open include file: 'winsock2.h') suggests that Windows SDK is not installed or not picking up. I would make sure C:\Program Files (x86)\Microsoft SDKs\Windows Kits and/or C:\Program Files (x86)\Microsoft SDKs\Windows exist and then in cmd issue SET PATH=C:\Program Files (x86)\MSBuild\14.0\BIN;%PATH% followed by npm install selenium-webdriver.

@jasonwilliams200OK I tried with latest nodejs (5), npm (3.4) and windows10x64 with your instructions without luck. I get the same error. I thinks the key is this:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry.
but I don't know how to fix it.
Thank you!

@ricmed205, what do you see in the following locations:

C:\Program Files (x86)\Microsoft SDKs\Windows
C:\Program Files (x86)\Microsoft SDKs\Windows Kits

@jasonwilliams200OK
I don't have C:\Program Files (x86)\Microsoft SDKs\Windows.
I have C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs and then a couple of folders there with some files. Is there a specific file I should be looking for?

@ricmed205, sorry the location is C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um\WinSock2.h. With Windows 10, the C runtime is part of OS. Do you have C:\Program Files (x86)\Windows Kits\10\Include\ directory?

@jasonwilliams200OK I found WinSock2.h at "C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um"

@ricmed205, this means your SDK is installed properly.
For some reason, the SDK cannot be located on your system. It could be a registry value not set or gyp canot locate the SDK (https://github.com/nodejs/node-gyp/issues/679#issuecomment-137970103), Before trying the latter one, I would delete %HOMEPATH%.node-gyp\ directory and retry installing selenium. If the problem persist, then try the steps laid by @fresc81.

I finally got it working checking BOTH windows 10 SDKs and windows 8 SDK (I'm on win10) when installing the 2015 build tools. It seems that somehow the windows 10 SDKs is built on top of the windows 8 SDKs OR the windows 10 SDKs package has a bug that fails to add the correspondent registry values, and my system is simple using the windows 8 SDKs (when I added it later).
Also, I must point out that downloading the 2015 build tools installs a +2gb microsoft visual c++ tools and a 2.12gb development kit (plus the other redistributable packages). So ~4.5gb total files. Not sure the size of the complete VS install and if it is a net gain...
@jasonwilliams200OK thank you for your help! @igorpupkinable too!

@ricmed205, thanks for the info. So the clean steps for Windows 10 are:

Install Windows 7, 8.1 or 10.
Install node.js latest version.
Install Python 2.7.
Install Build Tools and make sure to check Windows 8 SDK.

Then try npm install selenium-webdriver.
If I get a chance, I will prepare three virtual machines with Windows 7, 8.1 and 10 to verify these four steps. If someone else has time, please feel free to take a a lead. If you don't use vagrant, then the virtual machines can be downloaded from https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/ (these are for web testers but we can install node.js, Python and Build Tools as well).

So ~4.5gb total files. Not sure the size of the complete VS install and if it is a net gain

I think 4.5GB is still less than Express for Desktop, Community or Professional editions of Visual Studio 2015. I think with Express, the size become 6-8GBs. With Community and Professionals, it is around 13GBs (based on the components selection to be installed).

Chiming in here: Part of this problem is that Microsoft insists on distributing their compilers with their bloated IDE.

@Qix-, news for you: https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245. Please READ before chiming in here.

@jasonwilliams200OK that hasn't been true for over a decade. Excuse me for not reading a discussion with > 200 very large comments.

@Qix- as far as i know till VS2008, they used to had build tools. They discontinued in VS2010 then bring it back in VS2015. Yeah its weird but its better than the bloated IDE, agree?

I just updated the description with an update about the fix

hi @jasonwilliams200OK
I got error :
Traceback (most recent call last):
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 18, in
sys.exit(gyp.script_main())
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 534, in script_main
return main(sys.argv[1:])
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 527, in main
return gyp_main(args)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 503, in gyp_main
options.circular_check)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 98, in Load
generator.CalculateVariables(default_variables, params)
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1798, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 400, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2015'
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Project\Gooddata\test\gdc-client\node_modules\grunt-gd-spriter\node_modules\node-gd
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
=====================
and
npm ERR! node-gd@0.3.5 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-gd@0.3.5 install script.
npm ERR! This is most likely a problem with the node-gd package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-gd
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd D:\Project\Gooddata\test\gdc-client
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
I think node-gd not support windows is the problem .
thanks

@luisrudge, [My solution] (https://github.com/nodejs/node-gyp/issues/629#issuecomment-138276692) also works with 0.x.x versions (only) of Node.js and tested on clean Windows 7/8/10 installations. You can also add it to description.

@Sogl Let's stick with node v4+

Agreed with @luisrudge. The cpp build sku solution posted also works with node v0.x. Given the amount of contusion around this topic let's just stick with the simplest recommended way (cpp build sku) and one for when VS is already installed rather than trying to complicate things any further. Because if we provide too many options, people are just going to get even more frustrated trying all of them trying to get something to work even though that wasn't actually the issue they were running into.
Sent from my Rotary Phone
_____________________________

From: Luís Rudge notifications@github.com
Sent: Monday, November 16, 2015 7:48 PM
Subject: Re: [node-gyp] Windows users are not happy. (#629)
To: nodejs/node-gyp node-gyp@noreply.github.com
Cc: Sara Itani itani@outlook.com
@Sogl Let's stick with node v4+
—
Reply to this email directly or view it on GitHub.

The mess of this thread is now part of the problem.
It would be good if there was a nice well written page summarising the issues and solutions.

There's a summary in the first post. What else would you like to see there?

De: dukedougalmailto:notifications@github.com
Enviada em: 17/11/2015 08:15
Para: nodejs/node-gypmailto:node-gyp@noreply.github.com
Cc: Luís Rudgemailto:luis@luisrudge.net
Assunto: Re: [node-gyp] Windows users are not happy. (#629)
The mess of this thread is now part of the problem.
It would be good if there was a nice well written page summarising the issues and solutions.

Reply to this email directly or view it on GitHub:
https://github.com/nodejs/node-gyp/issues/629#issuecomment-157327549

@phthong,
The error you are seeing is reported in https://github.com/nodejs/node-gyp/issues/555 and I agree with others to consider updating node.js version to latest in 2 minutes by going to http://nodejs.org and clicking few buttons. In principle, the fix should be in 0.10 branch too, but your 0.10 patch level is 25, while the latest is at patch 40: https://nodejs.org/dist/latest-v0.10.x/.

Will "it work" after I update node.js?

No; you are trying to install package called node-gd which does not support Windows at this point.
It turned out the original repo is https://github.com/taggon/node-gd/ where the development is discontinued. Last Commit was on Aug 17, 2012.
However, there is a "community maintained" fork by @y-a-v-a, which installs with npm install node-gd, but as you can see here, there are some challenges in porting this package, which was originally designed for Unix systems only. One of the challenge I reckon is to enforce the presence of libgd and then locate it, which I imagine @y-a-v-a may want to build from source on installing the package on Windows (and can use same method if the package is missing on Unix). To be able to do that, the first step is to make sure libgd compiles with VS2015, which it doesn't at the moment (so I have opened a pull request https://github.com/libgd/libgd/pull/192, lets see..).
In other words, you can follow the progress on node-gd support at https://github.com/y-a-v-a/node-gd/ as your issue belongs to that specific package.
@luisrudge, thanks for the update. The whole community have got at least one achievement (build tools) by the virtue of this thread of yours. Unfortunately, the road to productivity is paved with people who just can't stop trolling..

@jasonwilliams200OK May I remind you that snarky or overly emotional responses on Github are generally looked down upon. Github is a place of collaboration. Not everyone is going to have the same background or information as you.
Being rude or negatively passive aggressive does not help a conversation and is rather poor sport as Github prides itself in being quite an exceptional community, devoid of insult or lashing out from those above others. Everyone here is here to learn and to grow, together, in a very raw (and yes, often times direct) fashion. There is no need (and no place) for attitude.
I hope one such as yourself could appreciate this. Let's keep things civil and at the very least professional and respectful, okay? :+1:

@nodejs/documentation do you think we should make an official guide about this?

@mousetraps are the setup instructions you advice in https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245 a preferred way to setup node? Should we send a PR to the README to update the setup instructions?

@TheAlphaNerd I for one would certainly appreciate some definitive, documented answers to the many difficulties of node-gyp. Calling out some of the difficulties explicitly might even produce some solutions or at least be useful to future projects with similar aspirations.
I submitted a series of questions above that @dekarguy has partially answered. I'd really love some in-depth discussion of these.

hey @togakangaroo

@nodejs/documentation do you think we should make an official guide about this?

I think it would definitely make sense to have some form of this in some form of official docs. It may make sense for it to live here https://nodejs.org/en/download/package-manager/#windows or at least be referenced there, since nearly everyone using Node.js on Windows needs to build a native addon at some point.

Yup I think something in the readme and a reference there on the website

Definitely would +1 seeing a "How Shit Actually Works" article. The one thing I see among Javascript developers is a completely lapse in understanding of what Javascript is and how it's handled under the hood. Many developers don't know what bindings are, how compilation works, what the difference between a scripting/systems language is, etc.
I think a lot of people are asking questions when they don't have even a basic understanding of how the whole ecosystem works.

authors: ArtskydJ Fishrock123 GradyD JpEncausse Pharylon ProtomotoReal Qix- Sogl TheAlphaNerd TooTallNate af7 am11 antelle b-long baazoo bengl bgSosh bmuenzenmeyer bnoordhuis cannedconcept coldwinds daanl damibarbieri dekarguy devvdi dlong500 donaldhook dperu dukedougal erezcohen ericgrosse fuczak gallak87 glen-84 gwely igorpupkinable jackinf jasonwilliams200OK joeeames johanalkstal joncaves luisrudge marco-faustinelli mesosteros mousetraps orangemocha paulvanbrenk phthong pierol ppeterka rainabba renatoargh ricmed205 spawn-guy stupidisum thorn0 thoroc togakangaroo tomitrescak ukrbublik vanflymen vdh

repo: nodejs/node-gyp