Uh oh!
There was an error while loading. Please reload this page.
fix: windows download incorrectly selects 32bit on 64bit machine - #5025
fix: windows download incorrectly selects 32bit on 64bit machine#5025styfle wants to merge 4 commits into
Conversation
Signed-off-by: Steven <steven@ceriously.com>
ovflowd
commented
Jan 20, 2023
I appreciate the PR, but we're on a code-freeze right now, not to mention all the current "javascript/jquery" code is going to be trashed, as we transition to the codebase from nodejs.dev. Would you mind opening an issue instead of a PR? So we can work on that when we start migrating the layouts? Thank you! |
I created issue https://github.com/nodejs/nodejs.dev/issues/3162 I also created PR nodejs/nodejs.dev#3163 |
nschonni
commented
Jan 20, 2023
Closing this, as the error is on the |
@nschonni The |
styfle
commented
Jan 20, 2023
I created #5028 so you don't lose track of the However, I suggest you reopen my PR here since it is still relevant. |
nschonni
commented
Jan 20, 2023
No, the download URL comes from .org for both, but only https://nodejs.dev/en/ has this problem, not https://nodejs.org/en/ |
styfle
commented
Jan 20, 2023
@nschonni Both have the same issue. Did you try it? Here's a screenshot with proof: |
nschonni
commented
Jan 20, 2023
It's possible something in the Insider build is broken, I can reproduce your issue on PS: The solution isn't to wipe out the architecture detection and always serve x64 |
styfle
commented
Jan 20, 2023
Could be. Or it could point to changes coming in the future where the user agent no longer includes that information.
How about flipping the |
nschonni
commented
Jan 20, 2023
Definitely possible, but could also just a be a regression in a particular build. Here is the Edge user agent for Win 11 Edge
If you can find a way to do that, but I think only 64 had indications in the user agent, so that's why it is done this originally. I think most of the actual x86 windows versions are approaching EOL, so there may be value in visiting the approach as part of the redesign |
styfle
commented
Jan 20, 2023
I investigated some more and found out Windows 11 is only 64 bit, there is no 32 bit version. Furthermore, there is no way to detect Windows 11 based on the user agent string.
https://www.whatismybrowser.com/guides/the-latest-user-agent/windows So then I found the official microsoft docs which say to use client hints or this JS script: navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then(ua=>{if(navigator.userAgentData.platform==="Windows"){constmajorPlatformVersion=parseInt(ua.platformVersion.split('.')[0]);if(majorPlatformVersion>=13){console.log("Windows 11 or later");}}});https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11 I confirmed that this works on the insiders windows 11 build because But then I looked at MDN and saw this can be simplified even further to check for bitness. navigator.userAgentData.getHighEntropyValues(["bitness"]).then(ua=>{console.log(ua.bitness)// "64"});https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/getHighEntropyValues I think adding that script should solve the problem since it works on my build of windows 11 😄 Thoughts? |
nschonni
commented
Jan 20, 2023
That might make sense, but I'd suggest keeping the existing checks, and adding as the other |
I wanted to mention that UA's are being sunset (frozen) (through phasing). It will be tough to predict future OS's User-Agents in the future, as browsers will stop updating them. This is already reflected in Windows 11 by giving less information. |
@nschonni@ovflowd I pushed some changes to this branch to use the new API. Can we reopen this PR? (function(){'use strict';if(navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues){navigator.userAgentData.getHighEntropyValues(['bitness']).then(function(ua){initDownloadHyperlink(ua.bitness);}).catch(function(){// Ignore errors since not every browser supports this API});}else{initDownloadHyperlink('unknown');}})(); |
ovflowd
commented
Jan 20, 2023
I'm not sure how adopted this API is. What is the caniuse.com of this API? Anyways, I would highly recommend not making PRs to nodejs.org, as this will all go to waste. This main.js is going to be discarded very soon, so I recommend a PR against nodejs.dev to improve its detection mechanism there :) |
styfle
commented
Jan 20, 2023
I did create one here nodejs/nodejs.dev#3163 |
ovflowd
commented
Jan 20, 2023
Does that PR contain similar changes? (Leveraging the new API?) |
styfle
commented
Jan 21, 2023
@ovflowd Yep, both PRs are very similar using the same |
styfle
commented
Feb 1, 2023
@nschonni@ovflowd@shanpriyan Anything else we need to land this? |
ovflowd
commented
Feb 1, 2023
ovflowd
commented
Mar 12, 2023
@styfle could you rebase your PR so we can get this merged? |
ghost
commented
Mar 14, 2023
@styfle : The file is totally changed with the new tech for Nodejs.org. So yours is useless and I've closed your change and re-open a new PR for you. Any suggestions welcomed! |

I just installed Windows 11 64 bit and opened Edge to install Node.js and it incorrectly installed the 32 bit version.
User Agent:
Also
navigator.cpuClassis undefined so we need a new way to detect the the bitness.