Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack-dev-server will not work on Windows due to its dependency on node-gyp #229

Closed
YarivGilad opened this issue Jul 31, 2015 · 17 comments · Fixed by #302
Closed

webpack-dev-server will not work on Windows due to its dependency on node-gyp #229

YarivGilad opened this issue Jul 31, 2015 · 17 comments · Fixed by #302

Comments

@YarivGilad
Copy link

Hi, I need to ask if webpack-dev-server's dependency on node-gyp is absolutely necessary?
node-gyp is a nightmare for many node developers that develop on a windows machine.
it needs a C++ compiler which forces you to download visual studio and all sorts of service packs that got nothing to do with node development. in our case - after a 1.6 Gigs of installations and dependencies we were still unable to make node-gyp work on windows...
Why would webpack-dev-server however need node-gyp as a dependency?
As far as I know it has an express http server with socket.io... the webpack package alone doesn't require node-gyp, so why the webpack-dev-server need it?
Can you let it go? it creates a lot of unnecessary pain for developers...
Cheers
Ajar

@YarivGilad
Copy link
Author

Anyone here have any idea why node-gyp is essential to webpack-dev-server?
Can this dependency be removed?
It is well known that node-gyp is a real pain for developers using windows...
It seems like the dependency is used by bufferutil in engin.io in socket.io...
\webpack-dev-server\socket.io\engine.io\ws\bufferutil
Is there a work-around?

webpack

@SpaceK33z
Copy link
Member

This is necessary, because otherwise the dev-server can't livereload itself.

@sokra
Copy link
Member

sokra commented Aug 8, 2015

I think the native stuff in bufferutils is an optional dependency and you should be able to install it without it. Otherwise send an issue to the engine.io repo.

Here is a guide how to make node-gyp work on windows. As far as I remember it was straight-forward: https://github.com/TooTallNate/node-gyp/#installation

@YarivGilad
Copy link
Author

Hey @SpaceK33z ' hi @sokra
Thank you for answering first of all.
My guess would be you are probably developing on a mac??
@sokra - believe me - I know this straight forward quite well as I went through it and other threads over two weekends I burned on this matter with all sorts of possible remedies after the "straight forward" way failed. I know this issue first hand up close. it has to do with node-gyp and node-gyp only. so to file an issue on socket.io is not relevant because it uses engine.io which uses ws which uses node-gyp.
The only way around it is to find a bypass to socket.io like sock.js for example, assuming they don't have a node-gyp dependency...
If this issue is not addressed then a massive amount of developers working on windows are instantly becoming excluded from the potential users of webpack-dev-server.
Please do not write it of as a non issue and do not treat it lightly as if it will take care of itself.
node-gyp is a nightmare and should be avoided if possible.
Thank you
Ajar

@dennis-b
Copy link

HI
I also ran into a 'node-gyp nightmare', the are no "straight forward" way to install node-gyp on windows. for now i using gulp watch for bypass.

do you found a solution for this?

best regards
dennis

@YarivGilad
Copy link
Author

no solutions. and as you're saying - definitely not "straight forward"...
whoever claims it to be a non issue doesn't know what he's talking about and is probably a mac user.
As tool creators, webpack's contributors need to know that they are giving up on an entire developer community which uses windows. don't be blind to anything outside your own bubble.
This needs to be addressed. For developers using windows there is no way to use webpack dev server.
You need to be well aware of that. Gulp works perfectly fine on any platform. and if it means I'll give up hot reloads while developing and god forbids - refresh the page - well... so be it!

@bjrmatos
Copy link

in my daily job i use Windows and i agree that node-gyp is a nigthmare on windows, but after follow https://github.com/TooTallNate/node-gyp/#installation i have everything working.

also this issue should go in the engine.io repo.. it's not webpack's fault

@YarivGilad
Copy link
Author

I'm glad for you node-gyp works on your system. It doesn't on mine and on others.
Webpack chose to use it. there are other alternatives.
It is not about fault, it is about providing a cross platform build tool for web developers not assuming they've got anything to do with c++
It is not even engine.io's fault but Joynet who came up with node-gyp
Why would you let a web developer npm install a package that starts to compile c++ code?
It is a source for problems (hence the nightmare).
It is not acceptable to expect a web developer download almost 2 gigs of dependencies to be able to compile c++ code that they got nothing to do with.
When things blow up (and they do!) you are left without a clue and this is a VERY bad experience.
The alternative would be that the person who writes the library which needs compiled C++ code will compile it himself and supply the compile binaries in the npm installation. you should be able to detect the os and download the proper precompiled binaries along with the library.
Webpack can simply use SockJS assuming it doesn't have a node-gyp dependency or a different alternative for that matter.

@sokra
Copy link
Member

sokra commented Oct 23, 2015

I use windows, and it works fine. I have two machines one with VS and Python so the node-gyp works and one without both of them and webpack-dev-server still works fine. The native dependencies are optional and everything works also without them.

If you doesn't work for you that propably an issue of an incorrect node-gyp configuration and not a missing one.

Webpack can simply use SockJS assuming it doesn't have a node-gyp dependency or a different alternative for that matter.

Feel free to send a PR. The public interface doesn't expose socket.io.

@seetsy
Copy link

seetsy commented Oct 23, 2015

I don't use Windows, but unfortunately other team members do so I also feel the pain. We used to run into the node-gyp nightmare every time someone new tries to run their first maven build.

team member: "Hey, the maven build is failing - its complaining something about npm. I have npm installed, what's up?"
me: "Oh right, do you have python and visual studio installed?"
team member: "Uhhh no... Why would I?"
me: "Ok, just install those and try again."
3 hours later..
team member: "ok they're installed - it's still failing. now what?"
me: sigh... "ok let me come over and look"
Do some googling, read some blogs, try random stuff...
4-8 hours later...
"Success! We got it working finally after wasting an entire day."
team member: "Why did we do this again?"
me: "Some javascript packages needed to compile c++"
team member: "huh?"
me: "don't ask..."
team member gives me a strange/dirty look...

I now leave all node-gyp dependent packages out of our package.json dev dependency list.

@SpaceK33z
Copy link
Member

I've started trying to convert webpack-dev-server to use sockjs. Will create a PR when it's done.

I often get complaints from other co-workers as well, because node-gyp requires you to install some build packages on Debian. This is easily fixable, but I think a project should work immediately after a npm install.

SpaceK33z added a commit to CodeYellowBV/webpack-dev-server that referenced this issue Oct 24, 2015
This removes the node-gyp dependency :).

Fixes webpack#229, webpack#276, fixes webpack#195, fixes webpack#267, fixes webpack#258 and fixes webpack#242
@SpaceK33z
Copy link
Member

@Ajar-Ajar and @dennis-b, I've created a PR that replaces socket.io with SockJS (#302). Can you please test if it works for you?

@dennis-b
Copy link

Hi

I tested it on my environment and it works fine.

Thanks a lot.

sokra added a commit that referenced this issue Nov 24, 2015
Replace socket.io with SockJS as discussed in #229
@YarivGilad
Copy link
Author

Awesome work @SpaceK33z!!!
Finally with SockJS it does indeed work!
Wohoo :)

@Himanshuj1088
Copy link

Hi Ajar-Ajar, SpaceK33z,
I have installed web pack server and as per the earlier comments the issue with window is resolved.
But still I am unable to run web pack server.
Please could you help with it?

@rennen
Copy link

rennen commented Feb 28, 2017

I'm a C++ developer, and I agree with Ajar-AJar that it makes no sense.

@SpaceK33z
Copy link
Member

The only dependency that requires node gyp is watchpack now (indirectly, via chokidar). There is an open PR in watchpack that removes that switches chokidar to sane, removing the node gyp dep (am on mobile now, so no link). Please help test that PR there instead of complaining here.

@webpack webpack locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants