node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Windows users are not happy.

Open luisrudge opened this issue 11 years ago • 474 comments

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

luisrudge avatar May 22 '15 03:05 luisrudge

challenge accepted

Nice! Good luck @mousetraps :)

b-long avatar Aug 06 '15 18:08 b-long

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.

ArtskydJ avatar Aug 06 '15 18:08 ArtskydJ

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

luisrudge avatar Aug 06 '15 18:08 luisrudge

Dug into this a bit today, and have some (heavily caveated) good news.

VS isn't necessarily required - we didn't really publicize this much, but Microsoft released the C++ compiler pkg targeting Python 2.7 a while ago, and 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, it wasn't verified for use with node, etc - so don't expect bug fixes or improvements. But if it happens to work fine for you, then great :smiley:

AFAIK... that combined w/ python 2.7 & the Windows SDK should be sufficient, but someone else should probably verify. It worked fine with the few pkgs I tried to install.

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.

EDIT Here is the link to the windows sdk I used - I've only tried Win 7 - I haven't tried Win8 or Win10 yet.

  • http://www.microsoft.com/en-us/download/details.aspx?id=8279

[PLEASE READ] And just to be crystal clear on this... I am not even close to being an expert in this space, and there are absolutely no guarantees whatsoever. It just happened to work for me for the pkgs I was trying to install, so hopefully it works for others too.

This compiler package is entirely unsupported and represents a snapshot of the last version that is fully compatible with Python 2.7. For the latest security and bug fixes, please use the latest version of Microsoft Visual Studio for any development work that does not directly interface with Python 2.7.

mousetraps avatar Aug 06 '15 22:08 mousetraps

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 avatar Aug 06 '15 23:08 luisrudge

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

mousetraps avatar Aug 06 '15 23:08 mousetraps

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 avatar Aug 06 '15 23:08 donaldhook

@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)

mousetraps avatar Aug 07 '15 00:08 mousetraps

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 [email protected] 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 .

donaldhook avatar Aug 07 '15 00:08 donaldhook

@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

> [email protected] 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! [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:\Users\Артем\npm-debug.log

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

Sogl avatar Aug 07 '15 03:08 Sogl

@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".

Same after SDK 8.1 full installation.

Sogl avatar Aug 12 '15 12:08 Sogl

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

b-long avatar Aug 12 '15 12:08 b-long

@b-long , I already use Linux VM... but I'm curious to get node-gyp work on Windows =)) I solved this problem on Windows 7, but 8 isn't giving up.

Sogl avatar Aug 12 '15 13:08 Sogl

@Sogl Ah, I see. Sorry about that.

b-long avatar Aug 12 '15 13:08 b-long

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 No need to set PATH, msvs_version and other "magic" things...

Packages browser-sync and socket.io installed successfully. Snapshot created.

Now I want to find a minimum set of libraries which make it works.

Sogl avatar Aug 12 '15 14:08 Sogl

Great...

On Wed, Aug 12, 2015 at 9:38 AM, Artyom Mezin [email protected] 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 .

donaldhook avatar Aug 12 '15 14:08 donaldhook

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: packages

p.s. I tried this on Windows 10, but I can't install SDK 7.1 compiler because: ev644afv-og And all .net 4/4.5 etc installators say that I already have .net newer version installed =(

Also if I use C++ compiler for python command prompt:

vcbuild.exe : error VCBLD0010: Project 'C:\nodejs\node_modules\browser-sync\nod
e_modules\bufferutil\build\bufferutil.vcproj' requires upgrade. Use 'vcbuild /u
pgrade' or 'devenv /upgrade' to upgrade the project. [C:\nodejs\node_modules\br
owser-sync\node_modules\bufferutil\build\binding.sln]

and with --msvs_version=2008:

c:\users\)\.node-gyp\0.12.7\deps\v8\include\v8stdint.h(10): fatal error C1083: Cannot open
include file: 'stddef.h': No such file or directory [C:\nodejs\node_modules\browser-sync\
node_modules\bufferutil\build\binding.sln]

Sogl avatar Aug 13 '15 02:08 Sogl

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. It's not installed by default. image

thorn0 avatar Aug 13 '15 12:08 thorn0

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 [email protected] 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 avatar Aug 13 '15 13:08 donaldhook

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

thorn0 avatar Aug 13 '15 13:08 thorn0