Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

A *plea* to include binary API required by socket.io into NodeJS core. #8005

Closed

Description

@tohagan

The Problem

There is unending pain on Windows for anyone attempting to use the beloved socket.io library. This is rooted in the fact that you're forced to perform a compile and worse in a SDK (Visual Studio 2010) most Windows devs ditched some years ago. You can kinda/maybe/possibly hack around it if you have admin privs and a lots of Window experience but basically any app that dares to use this wonderful lib is in for a ton of support issues and pain and most end users won't be able to get it working.

Just google search for "win7 nodejs socket.io" and feel the pain out there.

Today I'm hitting this issue yet again as I'm trying to use a new PhoneGap component that would be very cool with remote logging if not for this ten pound gorilla standing in my path.

It's not just Windows that experiences this pain. Other platforms also suffer but for me today it's another Windows issue and this is a recurring nightmare for anyone doing node on Windows.

The Solution

IMHO I think the right solution is to remove the need for compiling for what I think is now a frequently used CORE feature of node by adding the API required by socket.io into the node core code. So the fix then just just a Node upgrade rather than a two day torture test.

The Plea

Socket.io is FAB! It opens tons of cool trick doors for node. Please remove the pain. All the node community will rejoice.

Activity

  1. tohagan commented on Jul 27, 2014

    @tohagan
    Author

    FYI ... I'm using node 0.10.29

  2. TooTallNate commented on Jul 28, 2014

    @TooTallNate

    socket.io's only native dependency is ws, which actually has an optional compilation step that falls back to a vanilla JavaScript implementation if compilation fails.

    That said, the compiled portion of socket.io is optional and only benefits speed in the end. Where are you getting hung up exactly?

  3. bnoordhuis commented on Jul 28, 2014

    @bnoordhuis
    Member

    I think what @tohagan is complaining about is that gyp / node-gyp defaults to VS 2010 when auto-detection fails and GYP_MSVS_VERSION isn't set in the environment. (Upstream gyp defaults to 2012 now, by the way.)

    @tohagan You can set e.g. GYP_MSVS_VERSION=2012 or GYP_MSVS_VERSION=2013e (the 'e' stands for 'express edition') to pick a particular version of VS. See https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294 for the full list.

  4. TooTallNate commented on Jul 28, 2014

    @TooTallNate

    I'll look into updating gyp in node-gyp ASAP.

  5. tohagan commented on Jul 29, 2014

    @tohagan
    Author

    Yes .. As a developer with many years experience I can probably dodge this bullet and follow instructions on stackoverflow or here but the fact remains is that large numbers of end users of node apps and libs cannot. Yes I'm aware that ws is the problem. So I'm pleading that you include it into CORE so we can avoid the compiler issue and keep sockets fast.

    There are tons of great node libs and apps that are simply very painful to deploy on Windows because of this issue and this pain has now subsisted for many months. Hacking the environment does not fix it for non tech users. Please realise that Node is now maturing and that it need to be "turn key" installed for all users - not just developers. That's the very cool dream of npm.

    ws is a wonderful and essential part of NodeJS but because of the serious and constant pain this module creates for Windows deployment, I'm lobbying that it become part of NodeJS CORE library so we can finally bury the need to be compiling anything.

    So .. I'm pleading ... Can you please team up with the ws team so we can all rest easy at night knowing we won't have to face another request to install VS 2010 or any other developer tool in the morning.

    The fact is that now many NodeJS end users who install our node apps ...
    (a) Don't have admin privs on Windows
    (b) Don't have the technical expertise to dodge the ws bullet.
    (c) Are Not developers
    (d) Are Not Visual Studio developers
    (e) Ditched Visual Studio 2010 long ago

    However, these end users typically can download and install the next release of NodeJS. So I think ws and NodeJS CORE belong together - precompiled for each platform so we can forget this nightmare.

    Just do a Google search for "win7 nodejs socket.io" and you'll get the idea.

  6. mwbrooks commented on Jul 29, 2014

    @mwbrooks

    +1 Win7 support for socket.io would be incredibly helpful. Thanks for opening this discussion @tohagan!

  7. bnoordhuis commented on Jul 29, 2014

    @bnoordhuis
    Member

    You know, incorporating ws kind of makes sense in a twisted way. Websockets are a common enough use case that it makes a reasonable core addition.

  8. TooTallNate commented on Jul 29, 2014

    @TooTallNate

    None of this addresses the fact that ws falls back to JavaScript implementations of the modules, and thus native compilation is not a requirement.

    So I ask again, what is really the issue? Where are you being prevented from using socket.io?

    If you do npm install socket.io, and the native compilation part fails, then socket.io should still be installed and doing require('socket.io') in a script at that point should still work. Is this not the case?

  9. tohagan commented on Jul 29, 2014

    @tohagan
    Author

    Thanks @TooTallNate ... I will retest this. If it does work then perhaps the failure message on install need to switch to being a warning somehow (not simple I suspect).

    Another longer term solution for Node might be to ship the GNU gcc compiler as part of Windows NodeJS so we get a more uniform compiling environment that no one needs to install separately. Perhaps it becomes part of gyp/ node-gyp. I realise that for Windows coders, VS is much better supported.

    Might even be able to auto download / install mingw's port of gcc as part of the install process. Not sure if their licence will allow this. Might need to chat with them first.
    http://www.mingw.org/

    IMHO I still think ws belongs in CORE even with this.

  10. Qard commented on Jul 30, 2014

    @Qard
    Member

    +1 on core support for websockets.

    On a side note, including ws in core doesn't solve the native compilation issue for any of the other many native modules out there. The proposed solution does not solve the actual problem, which is that compiling native modules on Windows just sucks. With Google switching to gn, the future of gyp is a bit unknown--perhaps the state of native modules on Windows will improve as we work through the deprecation of gyp.

  11. tohagan commented on Aug 1, 2014

    @tohagan
    Author

    I managed to get past the issue for myself by setting GYP_MSVS_VERSION to 2012. Thanks!

  12. rlidwka commented on Aug 6, 2014

    @rlidwka

    Why do you even have to use it on native Windows? Just develop it using vagrant or something like that.

  13. dougwilson commented on Aug 6, 2014

    @dougwilson
    Member

    Another longer term solution for Node might be to ship the GNU gcc compiler as part of Windows NodeJS so we get a more uniform compiling environment that no one needs to install separately

    FWIW, this is what the Perl community does for Perl on Windows (Strawberry Perl distribution).

  14. tohagan commented on Aug 7, 2014

    @tohagan
    Author

    @dougwilson Very interesting. At present of course, the NodeJS community has invested some effort in Visual Studio C++ code & VS.NET projects so I guess if they went down this path you don't just drop the support for this existing code but rather, offer a migration path ... so there may be a period of time where you support both OLD (VS.NET code) and NEW (GNU gcc) and encourage projects to migrate over.

    The end game is a turnkey install that any non-tech user can safely and reliably perform on any platform after having only needed to install NodeJS.

    @rlidwka A Vagrant VM is serious overkill for running what is often a small JS script that would then be disconnected from the local Windows filesystem and the rest of the Window OS.

  15. tohagan commented on Aug 12, 2014

    @tohagan
    Author

    Was thinking the other day that perhaps a cloud based compile of binary node packages might be the way to go as it would ensure a uniform CI based build environment and remove the need for end users to install compilers or the joyent team to include them in NodeJS CORE. The Node framework could provide this as part of the npmjs.org service (it compiles package C++ code, runs unit tests and signs binaries that can then be published to npm registry and npm client checks digital signatures of binaries.

    A risk factor is that you can't confirm that source matches binary so I'm recommending this type of service uses digital signatures that include a reference to the GIT repo + version that code was built from so we can at least correlate the two. Another significant risk factor is running the untrusted unit tests in the build service.

    I also found this app that looks like it's implementing some of this ... but I wonder if it really belongs as part of the npm registry?

    If this app is solid and security-wise safe enough, it might be viable to solve the ws problem in the short term.

  16. 48 remaining items

  17. jloramas commented on Oct 18, 2015

    @jloramas

    +1 for removing VS dependency

  18. LeeU1911 commented on Nov 5, 2015

    @LeeU1911

    I found this topic by digging through a whole lot of pages in order to solve my problem with installing mongodb via npm. It also requires VCBuild.exe in the build path, aka Visual Studio dependency.
    As a Java developer, my organization obviously won't understand why I need to get a ~4GB+ copy of Visual Studio if I don't have a valid reason. This problem got worse since now I'm working on a new computer in a remote location and I have to go through all the pains with this again.

    So I also vote +1 for removing VS dependency.

    Sorry for the long rant.

  19. justinshea commented on Nov 8, 2015

    @justinshea

    +1

  20. cheoAlejo commented on Nov 17, 2015

    @cheoAlejo

    +1

  21. AngelEyesChina commented on Nov 17, 2015

    @AngelEyesChina

    +1

  22. akreienbring commented on Dec 7, 2015

    @akreienbring

    +1

  23. Marcoevich commented on Dec 14, 2015

    @Marcoevich

    +1 for removing VS dependancy

  24. bexoss commented on Dec 15, 2015

    @bexoss

    +1 It should be.

  25. jacolaisen commented on Dec 28, 2015

    @jacolaisen

    +1 you shall remove VS dependancy and leave the door open!

  26. er-sandeepsingh commented on Dec 28, 2015

    @er-sandeepsingh

    +1

  27. cherryliu commented on Jan 5, 2016

    @cherryliu

    +1. Thanks @tohagan! I thought I was blocked on build error on windows too, although sockets all works well. +1 to the point that the build errors could be changed to warnings instead! Socket.io is really an amazing tool that opens so many doors, it just needs this touchup on installation UX.

  28. tohagan commented on Jul 2, 2017

    @tohagan
    Author

    Was delighted this week to discover that the latest npm performs binary installs and creates a package-lock.json containing SHA checksums. Excellent work!

    After reviewing the breaking changes in npm v5.0, I recommend you npm -g install npm today!

  29. Mithgol commented on Jul 12, 2017

    @Mithgol

    Does the latest npm really perform binary installs? What part of http://blog.npmjs.org/post/161081169345/v500 does mention it?

    (It seems to me that the only place where http://blog.npmjs.org/post/161081169345/v500 mentions any binary is the phrase “One binary to rule them all: ./cli.js has been removed in favor of ./bin/npm-cli.js”.

    That's why I ask.)

  30. gibfahn commented on Jul 13, 2017

    @gibfahn
    Member

    (It seems to me that the only place where http://blog.npmjs.org/post/161081169345/v500 mentions any binary is the phrase “One binary to rule them all: ./cli.js has been removed in favor of ./bin/npm-cli.js”.

    That refers to the npm "binary" that you run, there's less "script calling script calling script" in npm5. It's not actually a binary (compiled) file though.

    As for native modules, npm will compile them using the system C++ compiler. However a lot of modules include prebuilt binaries for most platforms, using something like node-pre-gyp. Other than having a package-lock.json that notes down the dependency versions, I don't think npm5 is doing anything different.

    So if you want some package that's written in C++ to magically install without compiling, then you need the module developers to include prebuilt binaries in their npm package.

    There have been a number of improvements for people using Node on Windows (many led by Microsoft).

    • You can now just download the C++ compiler parts of Visual Studio (Visual C++ Build tools), there's even a one-liner that gives you everything you need to build native modules, see here.
    • You can use NuGet (i.e. Chocolatey) to get the compiler
    • As mentioned above, you can run in Docker containers, which gives you a Linux environment
    • You can use the Windows Subsystem for Linux, which gives you Ubuntu on your Windows box

    Also this repo is archived, issues with Node should be raised in https://github.com/nodejs/node. The only part of this that might be worth raising in nodejs/node is the discussion about either bundling a compiler, or moving to llvm ( @bnoordhuis how did that go?)

    For general questions about node, please raise issues in https://github.com/nodejs/help instead.

    I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions