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

Could https://github.com/PythonJS/PythonJS be used to remove the dependency on Python 2.7?

m1sta avatar Jan 05 '16 13:01 m1sta

@m1sta, packages can use cmake-js today and get independent of Python once and forever. cmake has zero external dependncies and a pure C/C++ solution to build C/C++ projects, for which you surely already have compiler installed. So, if you remove try-compile, and all system introspection, find_program, find_library, etc. Also remove the ability to compute depends in makefiles. If you took all those features away from cmake, you would be left with this cool thing called Gyp.

ghost avatar Jan 05 '16 14:01 ghost

@am11 Finally solve the problem by custom installation of Visual C++ Build Tool with both SDKs selected. Although with some yellow warnings during the npm install stage, it is so happy to see mongodb modules. :+1:

@mousetraps Just to remind that the VC++ Build Tools Technical Preview link here is already invalid. There should be another version after preview, right? I uploaded the preview file here in case somebody else would need the package before a new one established.

@jasonwilliams200OK Very helpful and impressive writing about all of this. Thank you very much.

Thank you all.

krave1986 avatar Jan 06 '16 15:01 krave1986

@jasonwilliams200OK I clearly have been living under a rock to have not ever heard of cmake.js. Why is this not more popular?

Are you aware of any tools or tutorials to transition a node-gyp based projects to cmake.js projects?

m1sta avatar Jan 06 '16 23:01 m1sta

@m1sta, I think the readme of that project repo has pointers on how to configure your package. After that Google is your friend to figure out "how to do X with cmake". The general idea is, whatever makes you productive with less hassle, with less dependencies and makes your users happy, just use it.

Why is this not more popular?

node-gyp first commit: Feb 3, 2012 cmake-js first commit: Mar 24, 2015

gyp was created by Google guys (Chrome team mainly), who are switching to a new replacement called gn. So gyp is kind of getting tanked. Cmake (https://github.com/kitware/cmake) is an alternative solution, used by many industry grade products too, and (IMO) much more mature and popular in the world than gyp.

v8 and libuv are the common denominators in Chrome and node.js, probably the reason why node.js guys preferred gyp as a weapon of choice in first place.

In this long thread alone, there are at least two issues which can be squashed if cmake is used: locating correct SDK on Windows 10 and using correct msbuild version given multiple installed VS/msbuild versions on target. Plus no dependency on Python (or worse, a specific version of Python on every install target, this in addition to the actual C/C++ compiler requirement).

An example: libgd is using cmake, node-gd (wrapper) is using node-gyp. libgd is supported on Windows, while node-gd is yet to introduce Windows support. If node-gd is configured with cmake-js today, it will take close to none effort to introduce Windows support with VS and Build Tools 2015 (hint: cmake's built-in system introspection as opposed to manually written Python, SH, Powershell or CMD scripts to find dependent libraries etc.); https://github.com/libgd/libgd/pull/192 has been merged.

ghost avatar Jan 07 '16 01:01 ghost

Hello everyone,

I got a bunch of errors on the line of this issue, tried much of the workarounds/solutions/fixes indicated here, but still getting an error: No such file or directory. I wrote a detailed gist to illustrate: https://gist.github.com/javlc/67220256c6e51573dc07

javlc avatar Jan 08 '16 16:01 javlc

For anyone still got node-gyp build issues such as corrupted library (node.lib). May be upgrade to node 5.4 stable does help. I tried to re-installed everything but things didn't work out until I upgraded my node installation. And for the sake of Windows installing instruction, the Windows 7 SDK in the README is not really necessary if you're on Windows 10.

xgenvn avatar Jan 09 '16 05:01 xgenvn

We're having success using the the c++ compiler that comes with the strawberry perl package: http://strawberryperl.com. This lets us build on a windows 7 machine without VS installed & is faster than vsbuild.exe.

Unfortunately on a machine that has both the strawberry perl provided compiler and the VS c++ compiler we still can't build as node-gyp defaults to choosing vsbuild.exe. Any advice on how to beat that would be welcome ;)

innerdaze avatar Jan 12 '16 20:01 innerdaze

My config:

  • Windows 7 x86 Enterprise
  • node v4.2.3
  • npm 3.5.3
  • Python 2.7.11
  • node-gyp v3.2.1
  • .NET framework 4.5.2 (was allready installed in that machine so I can't install 4.5.1)

I get an error installing buffertools:

npm install buffertools
  1. msvs version setting: npm config set msvs_version 2015 --global
  2. Installed VC++ Build Tools Technical Preview with default install --> Error persists.
  3. Installed VC++ Build Tools Technical Preview with custom install (Windows 8.1 SDK) --> Error persists.
  4. Installed VC++ Build Tools Technical Preview with custom install (Windows 8.1 SDK + Windows 10 SDK) --> Error persists.

Log extract:

C:\GBV\GBV_APILocal>npm install buffertools

> [email protected] install C:\GBV\GBV_APILocal\node_modules\bufferutil
> node-gyp rebuild


C:\GBV\GBV_APILocal\node_modules\bufferutil>if not defined npm_config_node_gyp (
node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modu
les\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Los proyectos de esta solución se van a compilar de uno en uno. Para habilitar l
a compilación en paralelo, agregue el modificador "/m".
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(35
6,5): error MSB6006: "CL.exe" salió con el código -1073741515. [C:\GBV\GBV_APIL
ocal\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files\MSBuild\14.0\bin\msbuild.exe` failed wit
h exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:276: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_proces
s.js:200:12)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\GBV\GBV_APILocal\node_modules\bufferutil
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

> [email protected] install C:\GBV\GBV_APILocal\node_modules\utf-8-validate
> node-gyp rebuild

It seems -1073741515 error code is about a missing DLL, I found that error code in @thevinci comment: https://github.com/nodejs/node-gyp/issues/629#issuecomment-165334528 but no solution was proposed.

I can't imagine whats going wrong...

I'm totally stuck at the moment.

Thelmos avatar Jan 14 '16 15:01 Thelmos

@Thelmos Just a reminder from a non-English speaker to check the paths of related resources if there is any non-English letter or symbol in the paths. I have not seen the exactly same error of MSB6006. But you can try your luck. :)

krave1986 avatar Jan 14 '16 16:01 krave1986

@Thelmos, in addition to @krave1986's suggestion, take a look at https://github.com/bnoordhuis/node-buffertools/issues/44 where the owner pointed to solution at https://gist.github.com/kosmobot/6020327. In my case, I couldn't locate setenv.cmd on a system running Windows 10 with these SDKs installed: v7.0, v7.0A, v7.1A, v8.0A, v8.1A and v10.0A; but buffertools does get installed without any compilation error. Some more information is available in gyp issue tracker: https://code.google.com/p/gyp/issues/detail?id=457 (note that the status of that ticket is still new, so we may expect a permanent fix from upstream at some point).

If none of the prescribed solutions work, you may want to try changing the PATH environment variable, so gyp picks up the correct msbuild version 14.0: https://github.com/nodejs/node-gyp/issues/629#issuecomment-163686121.

PS: note that -1073741819 is a very low-level nt.dll exception, which translates to STATUS_ACCESS_VIOLATION (0xC0000005) which could mean anything in this higher context. However, MSB6006 is the key here.

am11 avatar Jan 14 '16 17:01 am11

@krave1986 I can't find any path with special chars, log messages are very poor in this aspect, I would like some information about what file is missing.

@am11: I can't locate setenv.cmd but at least in https://github.com/bnoordhuis/node-buffertools/issues/44 log dump there is a clear message: The reference assemblies for framework ".NETFramework,Version= v4.0" were not found That's a nice explanation, in my case no information is provided about what files are missing.

I think node-gyp is picking the right msbuil platform toolset version (v140):

C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(35
6,5): error MSB6006: "CL.exe" salió con el código -1073741515. [C:\GBV\GBV_APIL
ocal\node_modules\buffertools\build\buffertools.vcxproj]

In relation to the error code I think you mistook the number, in my case it's -1073741515 (not -1073741819):

-1073741515 == 0xC0000135 == STATUS_DLL_NOT_FOUND

Someone knows what "STATUS_DLL_NOT_FOUND" stands for?

Thelmos avatar Jan 15 '16 08:01 Thelmos

@Thelmos, you are right I misread the error code (optical illusion?).

I think node-gyp is picking the right msbuil platform toolset version (v140):

I saw that and thought might still make sense what happens if first hand 14.0 msbuild.exe is used instead of v4.0 delegating v14 toolset. Most probably the error would be same as you suspected, but can't say for certain unless the solution is tested.

am11 avatar Jan 15 '16 08:01 am11

while i'm can't be sure which part helped for me, i'll tell what i did anyways (as far as i remember) (win 8.1)

(uninstalled some stuff) installed the build tool 2015 preview installed sdk 8.1 npm cache clean; rm -rf /node_modules (x) installed ms c++ compiler package for python 2.7 (x) run that c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat installed nodejs 5.4.1 npm config -g set msvs_version 2013 (yes 2013 !!, 2015 didn't work for me !?)

and then i did get kerberos compiled

(x) needed? i don't know

doktordirk avatar Jan 15 '16 16:01 doktordirk

8 hours with no success on Windows 10 This is a pain in the ass! I tried a lot and tried to get to work healthy-gulp-angular No chance!!!

dracon avatar Jan 17 '16 19:01 dracon

Hey everyone, thank you so much for all the awesome feedback on the Visual C++ Build Tools so far!

As has been mentioned earlier in this thread... there were some inconsistencies in the install experience of the VC++ build tools. Some folks - namely @hfinger, @dKab, @krave1986 - were running into issues during default install, whereas many others were not. These issues were often solved by selecting custom install and installing both SDKs.

At first, I was very confused because I had tested on several clean configs, but never ran into the issue. But I finally got a chance to dig into those issues and also chat with some VC++ folks internally, so just wanted to update you all on what I learned and provide a little more clarity.

The default install installs the full Windows 8.1 SDK and a partial Windows 10 SDK. Namely, the following components are installed from each...

  • Windows 8.1 SDK
    • :heavy_check_mark: shared
    • :heavy_check_mark: um
    • :heavy_check_mark: winrt
  • Windows 10 SDK:
    • :x: shared
    • :heavy_check_mark: ucrt
    • :x: um
    • :x: winrt

Now when the tools were initially released (CTP1), the default install worked fine, but the custom installs had some oddities. However, in the meantime, and this is what I missed... we released a CTP2. Unfortunately CTP2 has broken some things in the installer for the default install. Rather than installing version 10.0.10240.0 of the Windows 10 SDK, it is errantly installing version 10.0.10150.0. Now this, by itself would not be an issue. But the corresponding lib, include, etc. paths point to 10.0.10240.0. This results in those errors some people were seeing about being unable to find ucrt components like stddef.h.

And so, the new guidance - for the time being - is to choose Custom Install and select both SDKs, and rest assured this issue will be fixed for RTM (or you can copy and rename the 10.0.10150.0 folders to 10.0.10240.0.) Please let me know if this does not work for you and if additional steps are required, so we can try to fix by RTM.

Additionally, it appears that there's some difficulty in diagnosing the source of node-gyp issues in general (many of the issues brought up in this thread are not actually Windows-specific). In testing the VC++ build tools, I ran into many of these myself, so here's a table that should hopefully help diagnose these cryptic compiler errors in the future:

This table is also available in our new Node.js Guidelines repo, so please feel free to make PRs and generally engage with us there if you have any ideas for useful additions: https://github.com/microsoft/nodejs-guidelines

Next steps: I'll be updating the instructions in my original post to reflect these changes, will test with a few more configurations, and will be submitting a PR to the README with simplified instructions for both the new VC++ Build Tools and VS2015. After that, I propose we close this issue and spin further discussions off into separate issues because this one is getting a bit overloaded. Thoughts?

mousetraps avatar Jan 18 '16 03:01 mousetraps

Just as a general note, related to the build tools + specifically node-gyp with my system.

I don't feel I'm that unusual to be a developer on a windows machine with VS2010, VS2012 and VS2015 installed, I don't think I'm that unusual as a python developer to have Python 2.7.4 x86, Python 2.7.10 x86/64, Python 3.4.6 and Python 3.5.2 x64 installed either. Python in all these cases has no problem in finding the right compiler for itself in the registry and building its own compiler environment.

The app I am working on has a Flask backend based on Python 3, and it uses some Python libraries with binary dependencies such as lxml which compile with whatever C Runtime is correct for the version of python which is executing.

I have a gui based on Electron, and it has some tooling which depends on node-gyp as a dev dependency (supposed to make my life easier).

Given that the vast dependency tree needed for node_gyp is installed on my machine through the normal route and fully enabled in the registry, python is able to find whichever MSVC compiler it wants through it's own standard library (python 2.7 distutils can find the VS2013 compiler no problem). I have to do a truly painful environment switch mid build, not just re-ordering path variables but, exiting my virtualenv trimming specific directories out of PATH/LIB/INCLUDE so that the node_gyp step can execute. Maintaining the environment is work genuine as patches and updates will do updates to the environment that have to be unset.

Generating vcproj in python seems strange, when you could just generate a call to distutils.setup and leave all the donkey work to python and is already is needed and capable of doing the whole task. I have a build process which I would find hard to explain to Linus Torsvalds in order to basically do nothing unusual.

swinstanley avatar Jan 18 '16 12:01 swinstanley

Hi all, finally I give up ... lots of tries with paths, environment cmd files, SDKs, ...

I cant make Visual C++ Build Tools 2015 work in my Windows7 so I installed Visual Studio 2013 Express and all worked like a charm in first try.

Thanks all people here for the help provided, I'll check this issue periodically expecting some final "working for all" solution.

Thelmos avatar Jan 19 '16 07:01 Thelmos

Glad I found this thread! Thank you everyone! You're the Real Mvps!

El-Servas avatar Jan 19 '16 15:01 El-Servas

Meteor 1.2.1 uses node v0.10.40 and npm v1.4.9 internally and after 15GB+ of installations, it has failed to work... I'm trying to run https://github.com/lovell/sharp using meteorhacks:npm and there's always a Your application has errors. Waiting for file change. staring at my face.

aayushkapoor206 avatar Jan 21 '16 14:01 aayushkapoor206