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
@nodejs/documentation do you think we should make an official guide about this?
@mousetraps are the setup instructions you advise 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 (or at least acknowledgements) 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
so node is actually built using a whole bunch of stuff.
The source is a combination of C++ and JavaScript, with bindings in between the two. The two main libraries used in C++ land a libuv and v8.
libuv is used for doing asynchronus I/O including but not limited to TCP / UDP (web traffic), DNS resolution, and File system events (and a WHOLE BUNCH OF OTHER STUFF).
v8 is a JavaScript engine which is used to execute the JavaScript given to node, I believe it is also used to a degree with memory management but I am not super familiar with it yet.
There are things that are exposes in v8 and in libuv that are not exposed in javascript land. For example the bits you need to do serial port communication. There are also performance benefits in some cases, or native libraries already built in c / c++ that can be wrapped.
Hopefully that helps to answer some of the questions regarding c++. you should start a question in http://github.com/nodejs/help and @ me if you want to talk some more about it, or chat about the python build tool stack
@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 - not their fault, but it's hard to understand how not-straightforward-or-trivial it is.
@Qix- how are you supposed to learn if you don't ask questions?
@TheAlphaNerd That wasn't my point (I know I worded it weird). My point is a lot of the same questions are being asked because they don't have a basic understanding of the internals. It isn't their fault, but a lot of the questions I see about compilation stem from not knowing how the compilation system works. The fact MSVC is incredibly convoluted and requires a just-right environment doesn't help, either. That's why the terms "easy" gets thrown around for Unix tools because there is little environment setup necessary.
A guide explaining, even at a mid to high level, what gyp is, what it wraps, and what the underlying build system it wraps itself wraps, and what those underlying tools do (compiler/linker/etc.) and even going so far as explaining terminology behind common error messages, etc.
Once people start understanding the concepts of native development, I think we'll see a drop in questions, issues, and frustration, and a rise in quality within the native modules that do exist.
I totally agree with your sentiment.
Maybe if you make an issue over at https://github.com/nodejs/evangelism/issues someone might choose to put some time in. I agree it would be very meaningful.
One other thing I'd like to point out; a vast amount of users of Node.js come from a web background. Node.js is the epitome of the melding between native and web technologies. Gyp is seen as "the problem" when a lot of the times it's the build configuration within the modules is to blame - or, code is written but not tested (yes, web people, native code does actually need to be tested on each platform before it's considered "cross platform"!)
Things like that should be emphasized - the web world and the native world are enormously different.
@Qix- IMO, the developer typing npm install <package> shouldn't need to care if the package is native or not. This is a problem for the package manager to solve. Unfortunately, npm choose to ignore the real issue and put the burden on the developers.
@luisrudge that's in an ideal world, though. I would love to see that. My point of native code requiring testing on different platforms still stands. Developers don't do this before pushing to NPM.
It's not NPM's job to fix that, and Gyp can only do so much to mitigate that. Javascript developers aren't end-users, they're developers. They should at least have a basic understanding of what is going on underneath their own applications, IMO.
@Qix-
that's in an ideal world, though. I would love to see that. My point of native code requiring testing on different platforms still stands. Developers don't do this before pushing to NPM. It's not NPM's job to fix that, and Gyp can only do so much to mitigate that.
Yes. The point stands. It should be tested, but my point is that node-gyp shouldn't even exist. npm should distribute the native packages itself and if it failed to build in a certain environment, don't allow developers with the same environment to download the package.
Javascript developers aren't end-users, they're developers. They should at least have a basic understanding of what is going on underneath their own applications, IMO.
Basic is a very subjective word. IMO, if I install node-saas, I know it converts saas to css. That's the understanding a developer has to have. I couldn't care less if it does with c++ bindings or javascript. Same thing with socket.io and other the other packages that depend on node-gyp.
npm should distribute the native packages itself
There is a lot of extra overhead on that. Windows users would have to have the right MSVCRT installed. And then you have to instruct users not to build in debug mode, because we all know they would (Why is this package crashing saying "Missing MSVCRTD120.dll"?). And then users of OSX would have to make sure the code worked for them (there are a lot of compilation differences between each version, especially as of late). And then Linux users would have to compile a version for many, many different flavors of linux.
It's not feasible. That would kill the native Node scene and reduce productivity. Unless, that is, NPM wants to create its own cross-platform compilation service that compiles your code for a butt-ton of platforms and versions. I'll let the NPM developers decide the feasibility of that. :+1:
That's the understanding a developer has to have. I couldn't care less if it does with c++ bindings or javascript.
You should, though. You should understand what's going on underneath. That kind of mentality is a direct influencer in continued security concerns and bloat within NPM modules.
That's not to say you should know exactly how a library utilizes such technologies. That's a large part of the reason why you're using a library and not writing it yourself.
The point to understanding what's going on underneath is to know what an error message means and to know how to fix it. For instance, seeing that there is a syntax error in a released module indicates there is either a compiler version mismatch or that the original developer wrote code for a non-standard compiler/extension and to open a ticket only then. If it's a dependency issue, such as a missing library, you'd save yourself time by just installing the dependency yourself and then opening a ticket with the solution to either include it in the bootstrapping step or to just include it as a requirement in the documentation.
Either way, the lack of understanding of basic native operations is what is fueling a lot of problems with Node and the Node suite (NPM, node-gyp, etc.) - Node is simply a small, cross platform Javascript environment that wraps POSIX or otherwise unix-y system calls in slightly higher level constructs. That's how it got popular, and now that web developers have caught on to its usefulness, the percentage of users that actually understand the API's origins and how Node is structured (including what it actually does) is decreasing steadily.
But that's more off-topic than I think is appropriate for this thread.
By the way I like that node-gyp exists. I don't have to worry about configuring CMake or some other build system to build against Node and then make whatever a .node is - and then call those steps in a cross-platform manner in an install hook - for each of my repositories that uses native code. I don't personally prefer the style/manner that configuration files are formatted in, but that's purely taste. Node-gyp works well for what it does.
It's great to know that you know everything about node and how it's made and what it is from inside. But I don't care and I'm sure 95% of the developers that are not writing a node app don't care too. If it's hard for npm to do this for linux, because of the huge amount of distros, then fix this for windows users, since most of the issues related with node, on Windows, are related to this nonsense.
I'm not trying to turn it into a pissing match here. My point is that in order to solve problems you should understand what you're developing with. If an individual can't at least appreciate that, then I severely question their ability to write code, much less solve problems concerning cross-platform compatibility.
@Qix-, I made an accurate statement that most people are "just trolling" and blindly making comments without reading the thread. That was my observation.
If there is a specific problem related to topic (some X package is not installing on Windows vY given I have all the prerequisites installed), lets talk about it, find solution, feel "happy" about it and move on.
Keeping it "professional" means refraining oneself from being personal as well as sticking to the topic at hand (e.g. it makes zero sense to discuss cmake vs. gyp on this thread, especially when you have no idea what you are talking about).
Alright; I'm not going to cause drama with you.
The point is, there should be a resource that outlines how the build system for Node works. I think that's fairly agreed upon.