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

@mluparu can this also be made available via powershell package management? It'd be pretty nice to be able to do install-package vcppbuildtools2015 (or whatever) and get it onto the system.

This would be very useful for Windows Server Core (i.e. commandline only) as well as the new Nano server edition of Server 2016.

If there is also an option to extract the tools package as a standalone / self-contained folder, then this cli/text-based installer can also be made available via npm install vcppbuildtools2015 so people can conditionally take dependency on it (if(os.platform() === 'win32' && !HasAtleastVSVersionOrAbove(2015))).

ghost avatar Dec 02 '15 23:12 ghost

+1

Anyway I did the clean install on Windows 10 on VM, I only installed:

MS Visual C ++ Build Tools Technical Preview

with both SDK 8.1 and 10, finally setup the global variable of NPM:

npm config set msvs_version 2015 --global

instalacion 1

All perfect. :tada:

gioacostax avatar Dec 03 '15 00:12 gioacostax

Is there any way to download MS Visual C ++ Build Tools Technical Installation Preview full offline?

gioacostax avatar Dec 03 '15 00:12 gioacostax

I'll start by saying just thank you for all the suggestions. I hope we can further improve the acquisition of the VCBuild tools based on your ideas.

  • We will investigate what it takes to publish on powershellgallery.com to make install-package work. My team has little experience with that yet, so if there is anyone here with experience that wants to take a stab at it and publish a package under their own name, I'd be interested in working with you to later adopt it and evolve it.
  • As is it today, the VCBuild tools require elevation so not sure how it would fit in an npm install scenario. But presumably, if we achieve the above, maybe npm packages could take a dependency on it...
  • There is no .iso available yet for the VCBuild tools, but you can build an offline installer by launching the setup with the /layout switch. In the output folder you provide, you will have a cached version of all the packages required for installation. Unfortunately, due to the way the WinSDK 10 acquisition works, this particular package cannot be cached so you would still need Internet connection for it.

mluparu avatar Dec 03 '15 00:12 mluparu

As is it today, the VCBuild tools require elevation so not sure how it would fit in an npm install scenario.

  • The PowerShell text-based installer should not launch any GUI.

  • The PowerShell text-based installed should provide two modes standalone and system.

    • system: install the VC tools system-wide. This will be discoverable system-wide via registry. By default it will install at %ProgramFiles(x86)%\Microsoft Visual Studio 14.0, but user will be able to override it using --destination argument, then it wil install at user-defined-directory\Microsoft Visual Studio 14.0.
    • standalone: install the VC tools in the current-directory\Microsoft Visual Studio 14.0. This will not alter the registry or anything outside the current directory. It will not be discoverable system-wide, but only act like a standalone build kit which can be used to compile C/C++ code without further dependency. This will also accept the --destination argument. If we do my-custom-dir\Microsoft Visual Studio 14.0\vc\bin\cl test.c /TP, it should resolve all the dependencies local to the installed package, to make the code compile.
  • The npm text-based installed should provide three modes global, standalone and system.

    • system: same as above. The post install JS code will simply bail out after spawning the PowerShell install script with system argument.
    • standalone: same as above, except it will be hardcoded with --destination=.\node_modules\.
    • global: this is npm global npm install -g <package-name>, so it is a predefined location by npm and only "globally discoverable" by npm. Again npm will just spawn PowerShell install script as:
    ".\install-vc-tools.ps1 --standalone --destination=" + npmGlobalInstallLocation
    

ghost avatar Dec 03 '15 07:12 ghost

Wondering if C++17 modules will provide us exemption to recompile the v8 binding: http://blogs.msdn.com/b/vcblog/archive/2015/12/03/c-modules-in-vs-2015-update-1.aspx? Its a new stuff, could be with that feature, we may not even need FFI in future..

ghost avatar Dec 06 '15 10:12 ghost

@jasonwilliams200OK

No, because:

  1. Native modules are still run in the machine code understood by the target's processor.
  2. It's never safe to access internals of the underlying runtime from on top of it.
  3. Native modules don't necessarily have to be written in C++, and they often call libraries that aren't written in it. A couple examples are OpenSSL (written in pure C), Unix kernel calls (which are C bindings), and Rust.

dead-claudia avatar Dec 07 '15 02:12 dead-claudia

@impinball, you made good points. What I understood by the Native Modules blog post is that they will be compiled once for the given architecture and then consumers will be able to interact with them without recompiling. (same concept as shared libraries but with bit more 'flexibility' such as needing to have header files to program against the API):

Modules allow you to express the symbolic dependency your component is taking on providers of functionalities it needs, and the boundary of that dependency, directly in code. Modules eliminate the need for convoluted preprocessor voodoo to specify interfaces through header files. The preprocessor is there for you and works together with the modules system if you have no other choice but to work with macro-based interfaces, conditional compilation and code-generation. The preprocessor is a powerful beast with no structure and C++ Modules aren’t designed to do everything that it does. The preprocessor’s job is to generate pre-tokens for the lexer to consume. It has been put to creative usages, for more than 40 years, to generate various sorts of text, including HTML source documents.

I might be interpreting it incorrectly, need to play with this stuff more to find out 'what Native modules mean to FFI / JNI / P-Invoke'. :)

ghost avatar Dec 07 '15 08:12 ghost

HELP!

A Pain in the right backside! I thought had all this going but now i've got issues with the node modules that use v8, anyone know how to fix this ? i have many c++ compile errors like:

c:\users\nick.gray.node-gyp\4.1.2\include\node\v8.h(3181): error C2504: 'v8::O bject' : base class undefined [C:\Users\nick.gray\Desktop\xxx\kerberos\build\ke rberos.vcxproj] c:\users\nick.gray.node-gyp\4.1.2\include\node\v8.h(3188): error C2061: syntax error : identifier 'FunctionCallback' [C:\Users\nick.gray\Desktop\xxx\kerberos \build\kerberos.vcxproj] c:\users\nick.gray.node-gyp\4.1.2\include\node\v8.h(3190): error C2059: syntax error : ')' [C:\Users\nick.gray\Desktop\xxx\kerberos\build\kerberos.vcxproj] c:\users\nick.gray.node-gyp\4.1.2\include\node\v8.h(3190): error C2143: syntax error : missing ')' before ';' [C:\Users\nick.gray\Desktop\xxx\kerberos\build
kerberos.vcxproj] c:\users\nick.gray.node-gyp\4.1.2\include\node\v8.h(3194): error C2061: syntax error : identifier 'FunctionCallback' [C:\Users\nick.gray\Desktop\xxx\kerberos \build\kerberos.vcxproj]

Thanks Nick

nickjohngray avatar Dec 08 '15 05:12 nickjohngray

I got this error when i try install protractor-perf bufferutil dependency. I'm on windows8.1 installed python 2.7 and visual studio 2015 community, nodejs 5.0 npm 3.3.6

> [email protected] install E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil
> node-gyp rebuild


E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil>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.
  bufferutil.cc
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)': function template has already been defined [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
  E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(256): note: see declaration of '_NanEnsureLocal'
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(661): error C2039: 'FreeCallback': is not a member of 'node' [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\�d�m\.node-gyp\5.0.0\include\node\node_object_wrap.h(8): note: see declaration of 'node'
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(661): error C2061: syntax error: identifier 'FreeCallback' [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(665): error C2065: 'callback': undeclared identifier [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(665): error C2065: 'hint': undeclared identifier [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New': none of the 4 overloads could convert all the argument types [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\�d�m\.node-gyp\5.0.0\include\node\node_buffer.h(43): note: could be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size_t)'
  C:\Users\�d�m\.node-gyp\5.0.0\include\node\node_buffer.h(31): note: or       'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
  E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(672): note: while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(676): error C2440: 'return': cannot convert from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>' [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
  E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(676): note: No constructor could take the source type, or constructor overload resolution was ambiguous
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(683): error C2039: 'Use': is not a member of 'node::Buffer' [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\�d�m\.node-gyp\5.0.0\include\node\node_buffer.h(8): note: see declaration of 'node::Buffer'
E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [E:\Programing\Attrecto\aig-pdh-qascripts\node_modules\protractor-perf\node_modules\bufferutil\build\bufferutil.vcxproj]

devmetal avatar Dec 09 '15 12:12 devmetal

@devmetal Install a newer version of bufferutil, latest is 1.2.1.

bnoordhuis avatar Dec 09 '15 12:12 bnoordhuis

@bnoordhuis Okay, i installed and its fine, but the protractor-perf package depend on bufferutil, what can i do?

Edited: Interesting, if i install protractor-perf -g its working fine, but locally its fail

devmetal avatar Dec 09 '15 12:12 devmetal

@devmetal File an issue with them asking them to upgrade their dependencies.

bnoordhuis avatar Dec 09 '15 12:12 bnoordhuis

Sorry, my problem solved by god i think because i tried again and again and it works... My steps: Delete node_modules folder Delete protractor-perf from package.json Install again with --save switch After npm install for others.

After this steps, i deleted my node_modules again and install again and it works. (deleted)

devmetal avatar Dec 09 '15 12:12 devmetal

I got kerberos working. I had to use node v. 0.10.0 , use nvm. To change versions of node. And also follow these steps exactly . In order. Make a restore poont after each step. As it may fail. And fix the link error that must be done! https://github.com/nodejs/node-gyp/wiki/Visual-Studio-2010-Setup

nickjohngray avatar Dec 09 '15 16:12 nickjohngray

I'm on Windows Server 2012 R2 with Visual Studio Enterprise 2015 (with Visual C++ compiler) and this node-gyp crap still doesn't work...

Look at that:

$ npm install [email protected] --save
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
|


> [email protected] install {my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify
> node-gyp rebuild

/
{my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify>if not defined npm_config_node_gyp (node "c:\bin\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.
{my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify\build\contextify.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp .Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\bin\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:\\bin\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd {my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify
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:\\bin\\nodejs\\node.exe" "c:\\bin\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]" "--save"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
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 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!     {my-project-path}\npm-debug.log

I started reading contextify guidelines for Windows Installation, but I had enough. This is a joke...

Fortunately I somehow managed to fix problem with karma installation on my personal Win10 desktop: https://github.com/karma-runner/karma/issues/1691

Unfortunately this is a lottery. My friend, with a similar setup, wasn't able to fix it...

Sorry for all the frustration... I'm going for a holiday... NOW!

op1ekun avatar Dec 10 '15 13:12 op1ekun

I am with you. I am having similar issues trying to get fibers going on a 2012 x64 server..... Now have to try and work with various teams to get patches for their packages.... this is not a stable approach to deploying solutions.... I know that several folks on this thread have been attentive to the issue and appreciate that and dont mean any disrespect.

On Thu, Dec 10, 2015 at 7:54 AM, Lukasz Piatkowski <[email protected]

wrote:

I'm on Windows Server 2012 R2 with Visual Studio Enterprise 2015 (with Visual C++ compiler) and this node-gyp crap still doesn't work...

Look at that:

$ npm install [email protected] --save npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No README data npm WARN package.json [email protected] No license field. |

[email protected] install {my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify node-gyp rebuild

/ {my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify>if not defined npm_config_node_gyp (node "c:\bin\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. {my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify\build\contextify.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp .Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. gyp ERR! build error gyp ERR! stack Error: msbuild failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (c:\bin\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:\bin\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd {my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify 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:\bin\nodejs\node.exe" "c:\bin\nodejs\node_modules\npm\bin\npm-cli.js" "install" "[email protected]" "--save" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 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 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! {my-project-path}\npm-debug.log

I started reading contextify guidelines for Windows Installation, but I had enough. This is a joke...

Fortunately I somehow managed to fix problem with karma installation on my personal Win10 desktop: karma-runner/karma#1691 https://github.com/karma-runner/karma/issues/1691

Unfortunately this is a lottery. My friend, with a similar setup, wasn't able to fix it...

Sorry for all the frustration... I'm going for a holiday... NOW!

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

donaldhook avatar Dec 10 '15 14:12 donaldhook

@donaldhook Sure! No disrespect whatsoever, just needed to vent a bit :)

We use jspm for installing our packages.

jspm install npm:[email protected] seems to be working fine + we keep dependencies under version control so it should be easy/easier to pick it up.

op1ekun avatar Dec 10 '15 14:12 op1ekun

thanks @mousetraps solved my life problems. can actually do work now.

marksy avatar Dec 10 '15 15:12 marksy

@op1ekun, going by this line in the error log you reported:

{my-project-path}\node_modules\angular\node_modules\jsdom\node_modules\contextify\build\contextify.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp .Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

(catch is: v4.0)

perhaps this will fix your issue:

Sometimes on Windows 8/10, either msbuild in PATH or which node-gyp infers is not the latest one (note that you may have multiple versions of msbuild installed, one with VS and one with some version of .NET Framework and so on). To fix this problem, prepend the value of Environment Variables > Path with latest msbuild.

image

After that open a new cmd instance and run npm install [email protected] --save.

am11 avatar Dec 10 '15 16:12 am11