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
Thanks @am11 and @Sogl for the feedback on ISO distribution and the /layout flag! The VC team is looking into both issues.
@mousetraps I appreciate your help very much thank you.
Without heroic people such as @mousetraps actually solving these insane problems then the game would just be over.
If I'm using the wrong version of something then I shouldn't be hit with a wave of cryptic compiler errors.
I agree. There is also literally no way to accurately tell this, as far as I can tell, and from what I've learned from others. :/
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v140 to build using the v140 build tools. [C:\COMPANYDATA\WEB\Public\BM\AZPREP-BM-1.4.0_20151106T0945\node_modules\xslt4node\node_modules\java\build\nodejavabridge_bindings.vcxproj]
While trying to npm install a new update, I got the above. Following this thread, I downloaded the RC from @mousetraps above, but when I to uninstall, it fails saying blocked (even tried to reboot just in case it was a previous install issue). Below is the last bit of the log file which I suspect has the answer (looks like it's saying either I need to have something else installed, making me wonder what the point was) or like one of the required downloads is failing during setup.
Any suggestions?
[042C:03C8][2015-11-06T11:12:06]i000: MUX: Setup update feature is enabled. Evaluating conditions to determine whether to run setup update.
[042C:03C8][2015-11-06T11:12:06]i000: MUX: Checking http://go.microsoft.com/fwlink/?LinkID=606891 for update.
[042C:03C8][2015-11-06T11:12:08]i000: MUX: Failed to download the update xml file from http://go.microsoft.com/fwlink/?LinkID=606891 Setup will not be updated.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i052: Condition '(CurrentOperation = "Install") OR (CurrentOperation = "Repair")' evaluates to true.
[042C:03C8][2015-11-06T11:12:08]i000: MUX: Stop Block: NoApplicableUpdates : Update 1 RC does not apply, or is blocked by another condition on your computer.
[042C:03C8][2015-11-06T11:12:08]i000: MUX: Detect Completed
[042C:03C8][2015-11-06T11:12:08]i000: MUX: Wait for View to be loaded
[042C:10A0][2015-11-06T11:12:08]i000: MUX: Detect Completed, now create view
[042C:03C8][2015-11-06T11:12:09]i000: MUX: View loaded
[042C:03C8][2015-11-06T11:12:09]i000: MUX: Stop Block: NoApplicableUpdates : Update 1 RC does not apply, or is blocked by another condition on your computer.
[042C:03C8][2015-11-06T11:12:09]i000: MUX: Go to Blocker page.
[042C:03C8][2015-11-06T11:12:09]i199: Detect complete, result: 0x0
@dukedougal, I agree with @mousetraps; yours is not a Windows-only issue. node-sass v0.9.6 is not supported for node.js v5 on any platform. During this one year period, we experienced eight node.js module versions updates. In fact, the first version that supported io.js (aka node.js v1.x) was node-sass v2.0.0. Please update to latest version of node-sass (v3.4.1) in order to get more runtime versions support, tons of features in node-sass itself as well as the best Sass language v3x support till date via latest libsass. :)
Since we cannot provide a forward compatible binary due to process.versions.modules changes with current infrastructure of node.js C++ modules, therefore, we fallback to manual build if the suitable readymade binary is not found. v2+ of node-sass was the first to provide the proper fallback to "compile at install-time" mechanism for the new/unknown version of node.js. Unfortunately, that functionality was never backported to node-sass v0x and v1x branches (mostly due to the entire rewrite of binding layer and overall divergence, sprinkled with some procrastination and lack of majority consumers' interest in older version; as 0.9.6 corresponds to obsolete version of libsass so there is no point to invest time there).
Whenever you encounter such a problem, you can always search existing issues in node-sass issue tracker and file a new one if it wasn't reported before. We also have channel on gitter and slack.
@mousetraps, thank you! With this pace, I am sure the higher consumer satisfaction level will be achieved pretty swiftly. :)
@am11 how do even update to the latest node-sass? I haven't made any decisions along the way to even install it. I had thought it was controlled by package.json files or something? If I install it, won't I get node.js applications complaining because they want an earlier version?
Again I appreciate the help but when the answer to the question "why isn't it working?" is a long technical explanation, there is a reasonable question to ask about whether the ecosystem architecture is sound. Things should just work.
@dukedougal, the node-sass API also changed between v0.9.6 and v3.4.1. You are right, you cannot just update the node-sass version in C:\Users\username\devel\rubix\package.json and expect it to work right away. You will need to make the call sites to comply with node-sass API changes in your code (or if you are dependent on some node-sass downstream such as gulp-sass or grunt-sass, you will need to upgrade its version and save yourself from updating code every time node-sass API changes).
This is a sad fact of life, but I am sure you will find sufficient help from node-sass readme and existing issues to get your project upgraded against latest version of node-sass.
@dukedougal @Fishrock123 I agree that Windows or not, the user experience with native module compilation is pretty non-ideal, and luckily there are folks who are making steps towards a better experience with efforts like https://github.com/nodejs/build/issues/151
FWIW while testing the VC++ Build Tools, I wrote a script that runs through a large set of native modules in the npm registry, tries to build them, and saves some info about them like stdout, stderr, etc. (haven't gotten the chance to push the script / results to GH yet, but I'll post here when I do). After running through the script, I started noticing some patterns, have begun establishing common classes of errors, and am working on translating those errors into a more human and actionable language. Granted, it won't be perfect or precise, but hopefully we can use the results of that to provide more actionable resolution recommendations so that people aren't left wading through cryptic compiler errors.
@mousetraps That sounds like very valuable efforts that will be greatly appreciated at a human level. I love Node.js (LONG time MS shop and came over from .net early 2014) and for the most part, it's an absolute pleasure to work with, but many of these (of MS specific issues) leave me scared I've taken multiple companies in the wrong direction because of something as simple as an error that provides no information and NPM installs are nearly always the source and from there, it seems nearly always a node-gyp compilation issue so work that that and what this thread addresses, stands to make the entire node.js experience substantially better and less frightening :)
@rainabba I'm just visiting from the Linux world and it was there that I established my belief that node.js has a major problem with versioning, builds and incompatibility. node.js is a very long way from sunshine and lollipops on non-Windows platforms.
@mousetraps I followed your solution provided in this comment to the letter but now when I try npm install mongoose, I get the following error:
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 )
Traceback (most recent call last):
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 15, in <module>
import gyp
ImportError: No module named gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\dev\Pluralsight\Web Development with ExpressJS\node_modules\kerberos
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
I've tried re-installing node, putting it in a directory other than Program Files (to avoid a folder name with a space), updating npm, it always gives the same error. Searching for the error isn't particularly helpful because all the solutions given are how to fix a V8 build.
Edit: I tried out @Sogl 's solution outlined here and I get the same error, no module named gyp.
I've even tried updating the gyp folder that throws the error using git clone (outlined here) and modifying the source code of gyp_main.py directly (outlined here), but the error remains.
This is incredibly infuriating because I had this node-gyp error fixed for a few months until the problem resurfaced yesterday.
@mousetraps Thank you! It works and makes things so much easier. Tested on Windows 10 x64, Node.js 5.0.0 x64, npm 3.3.6 Successfully installed latest versions of:
selenium-webdriver
utf-8-validate
node-sass
phantomjs
bufferutil
+1000000000000000000000000000000000000
+1 I have Nodejs 5.0.0 x64, npm 3.3.6 and Win 8.1 x64. Should I try going with Win 10? I already tried lost of possible combiantions of VS, Python & node to make this work. But I obviously never succeeded...
Hi. Installed the Build Tools 2015 provided by @mousetraps, followed instructions, tried to install selenium-webdriver (node-gyp dependant) and got the error below. Any ideas? (nodejs 4.2.2, npm 3.4, windows 10x64) Thank you!
C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Users\rickm\AppData\Roaming\npm\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.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid versio
n number. [C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate\build\validat
ion.vcxproj]
validation.cc
c:\users\rickm.node-gyp\4.2.2\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No
such file or directory [C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate
\build\validation.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\rickm\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\rickm\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: node-gyp rebuild
npm WARN install:[email protected] Exit status 1
Update: I've gotten @mousetraps 's solution here to work on fresh installs of Windows 7 and 8.1 (both 64-bit machines). If you use node v5.0.0, it already comes with npm v3.3.6, which means you don't need to update npm.
@ricmed205 try to update to the latest npm. If does not help try the latest Node.js I have tested selenium-webdriver. Should be installing fine.
I try @mousetraps 's solution with windows 10 64 bit . Node 0.10.25 , npm 1.3.5 . but it not work
@phthong
but it not work
What didn't work? Which package is failing for you? What is the error you are getting?
@ricmed205, I tried installing selenium-webdriver with node.js 5 and it went well. According to google results, the error you are getting (Cannot open include file: 'winsock2.h') suggests that Windows SDK is not installed or not picking up. I would make sure C:\Program Files (x86)\Microsoft SDKs\Windows Kits and/or C:\Program Files (x86)\Microsoft SDKs\Windows exist and then in cmd issue SET PATH=C:\Program Files (x86)\MSBuild\14.0\BIN;%PATH% followed by npm install selenium-webdriver.
@jasonwilliams200OK @igorpupkinable I tried with latest nodejs (5), npm (3.4) and windows10x64 with your instructions without luck. I get the same error. I checked that I have installed the windows 10 SDKs. I think the key is this:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi nd WindowsSDKDir variable from the registry.
but I don't know how to fix it.
Thank you!