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
@Sogl I didn't follow from the beginning. Take a look at Updating npm's bundled node gyp if you already haven't.
Other solution would be to settle a non MSFT compiler and use one that is still available for the plateform.
@baazoo
Didn't help.
@thoroc
Also found info about build with pangyp:
npm i pangyp -g
npm config set node-gyp pangyp
Also this tool works with io.js. For me it doesn't work because my userprofile name in Russian. But it still use MS compiler...
Well I am resorting to install a VM with Ubuntu on it for dev. But I am not really happy to have to change OS just because node-gyp is forcing me into installing MSFT dev tooling. From I have read changing to an FOSS C++ compiler would mean a major refactoring of the tool itself. Which incidently and understandly, no one wants to undertake.
@Sogl I just encounterd similar issue when trying to install gulp-devtools.
c:\users\hamed\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083
: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\h
amed\AppData\Roaming\npm\node_modules\gulp-devtools\node_modules\socket.io\node
_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
validation.cc
c:\users\hamed\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083
: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\h
amed\AppData\Roaming\npm\node_modules\gulp-devtools\node_modules\socket.io\node
_modules\socket.io-client\node_modules\ws\build\validation.vcxproj]
This is what worked for me:
- Switched terminal from Powershell to CMD (Powershell didn't work)
set GYP_MSVS_VERSION=2015- Installed the package in my case
npm install -g gulp-devtools
There is one more suggestion!
@baazoo Just tried things you describe. Same 'v8.h' error =(
One last step that I want to try - install VS 2015 :satisfied:
I also resorted to the workflow @thoroc described (using a VM inside Windows).
@thoroc @b-long
Yep, guys. This problem also has led me to use Vagrant (with VirtualBox) and Scotch Box.
Sorry. The solution can't be "use a vm instead"
The root of this issue is that Microsoft's willingness to provide a c/c++ compiler on Windows is lackluster. Right? Is there not some other approach (e.g. using a Cygwin DLL or something from MinGW ) that might suffice?
@b-long can you elaborate on that? I'm sorry, but I'm a newbie :)
I have VS 2015 community, the build tools and nothing seems to work.... I keep getting a NanThrowError. I have the VC++ distribution, have set the msvs version, nothing seems to work.
Any insight or suggestions are greatly appreciated.
C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc>if not defined npm_config_n ode_gyp (node "H:\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\n ode-gyp\bin\node-gyp.js" configure build ) else (node configure build ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. odbc.cpp odbc_connection.cpp odbc_statement.cpp odbc_result.cpp dynodbc.cpp ..\src\odbc_connection.cpp(436): error C2668: 'NanThrowError': ambiguous call t o overloaded function [C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\bui ld\odbc_bindings.vcxproj] C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\node_modules\nan\nan.h(7 19): note: could be 'void NanThrowError(v8::Handlev8::Value)' (compiling so urce file ..\src\odbc_connection.cpp) C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\node_modules\nan\nan.h(7 11): note: or 'void NanThrowError(v8::Handlev8::String)' (compiling s ource file ..\src\odbc_connection.cpp) C:\Users\dhook\AppData\Roaming\npm\node_modules\odbc\node_modules\nan\nan.h(7 11): note: or 'void NanThrowError(const char *)' (compiling source file ..\src\odbc_connection.cpp)
@luisrudge Sorry, I'm a bit of a compiler newbie myself. Maybe @TooTallNate or someone else at Joyent ( @trevnorris ?) can comment. I'm fairly certain node-gyp on Windows is a pain point for many developers and as such, I'll do development / testing in a VM or remote server when I'm on Windows.
There's this discussion on StackOverflow, but IMHO we can do better than a variety of "try this..." or "maybe that?". Personally, I'd suggest my workflow (get yourself cygwin and ssh to something else). Otherwise, wait until Microsoft does something about this (they say they support the development of NodeJS) or until NodeJS core team addresses it.
Lastly, I'm also pretty sure this isn't @TooTallNate's fault :smile: . As far as I can tell, he was filling a gap that needed to be filled. This is the 85% solution and many people owe Nate thanks for it, but now the community needs to push the effort even further.
I'm sure it isn't @TooTallNate's fault. This issue was never intended to point a finger to anyone. With that being said, this workflow NEEDS to get better, hence the issue. How can Microsoft fix this? What needs to be done to fix this? Knowing this, we can move this discussion forward with MSFT people.
Oh no, I know you didn't think it's Nate's fault :) I just didn't want Nate to think, that I think, that it's his fault. I guess a better solution would be a script-able (or npm install-able) compiler, with proper settings, etc. as defaults.
That doesn't need to come from Microsoft, but it has to work on Windows and they know Windows better than anyone. Maybe some of the folks working on https://github.com/Microsoft/nodejstools or https://github.com/Azure/azure-sdk-for-node would know someone or know something about solving this?
@mousetraps @paulvanbrenk would you mind taking a look on this thread? :) Thanks!
IMO we might as well wave a dead chicken as expect a proper solution from MS. There are so many forces pulling in different directions in a company that size, and I doubt they would be able to steer things in the right direction just to help the node community even if they wanted to. (No offence intended to the MS people linked above. And I'd love to be proven wrong).
Is there a viable route we could take that didn't rely on MS compilers (or VMs)? (Perhaps that is a stupid question - I really don't know)
I intsalled nodejstools in VS 2015 and doing the compile in VS2015, I get the same errors ......
@donaldhook If an error occurs with node-gyp when you're installing https://github.com/Microsoft/nodejstools , perhaps writing an issue there would spur someone from MS to investigate ?
Will do ...
@luisrudge thx for the tag - agreed it's super frustrating... I'll start reaching out to people today - we'll see what we can do on our end to help improve the experience.
@bgSosh challenge accepted :smiley: