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:
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?
This issue is fixed (kinda)
@mousetraps pointed that Microsoft is shipping the C++ build tools separately now. Check here
Some updates on this gigantic thread
Absolutely non-official statement that @Microsoft is aware of this issue and seeing what can be done
@mousetraps said that this thread "is high on people's radar" at @Microsoft
Very good Q&A about noge-gyp issues on Windows and why they happen
@dekarguy took the time to answer some questions about what we all are going through
@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...
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.).
I will try this now, ignoring the warning message.
UPDATE: No luck... So, I will now install the ISO of VS 2015 (still I have the SDK semi-installed, not sure is this will matter or not)
UPDATE 2: SUCCESS with installing the VS 2015 from its ISO. And node-gyp seems to be working now.
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. Some output:
> [email protected] 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
> [email protected] 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
> [email protected] 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
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
> [email protected] 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
> [email protected] 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
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
> [email protected] 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
> [email protected] 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
> [email protected] 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
> [email protected] 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
As you can see, global modules now install in your node.js folder, not in AppData.
@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
> [email protected] 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! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 error 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:\nodejsfolder. - Update npm from 2.* to 3.*:
3.1.
npm i -g [email protected]3.2.cd C:\nodejs3.3.npm i [email protected]3.4.npm -v(must be 3.2.2) - Install python 2.7.9 and choose add to PATH in installation. After install
pythoncommand in console should work. If not, reboot your PC or repair installation. - Download and install Windows SDK 7. Choose
GRMSDKX_EN_DVD.isofor x64 andGRMSDK_EN_DVD.isofor x86. All checkboxes by default. If you see errorSome components cannot be installed(especially on Windows 10), install SDK fromSetup/SDKSetup.exe. More info. - Use
SDK 7.1 consolefor 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 [email protected] 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 [email protected]
- cd C:\nodejs
- npm i [email protected]
- 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 Windows 7 Professional edition, VS 2015 with all the C++ jazz, Python 2.7 in C:\Python27 (with env var PYTHON), no special MS packages and the variable
GYP_MSVS_VERSION=2015
set from the control panel, just like fifteen years ago.
This is the crappiest situation I've met in the last couple of years.
I am aware that setting env vars in the CMD window is not the same as in PowerShell, but I had all the vars in both environments, and only the one in CMD worked.
Working Solution on Windows 10
Can confirm @marco-faustinelli is right.
- 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 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)