Open cinderblock opened 9 months ago
The issue is that the Windows installer suggests to install Chocolatey, correct? If someone sends a PR to use a different package manager, it seems likely to me that it'd be accepted.
That seems correct to me. Most other installers I've used don't install some other tool to install more optional tools.
I guess there isn't really a reason to depend on winget
either. In my experience, usually installers with optional features give a more detailed drop down that allows users to opt in to each set of optional features directly - no external tooling necessary.
I'm thinking something like this:
Looking at the code, there are only a couple references to "chocolatey". It should be easy enough to replace/update install_tools.bat to use winget
- but maybe something higher level in the installer configuration would look better - maybe a user wants to use some existing python binary and to use gcc instead of VCTools (getting node-gyp to support that flexibility is outside the scope of this change) or different versions of Visual Studio.
don't know if this is the right place but also the chocolatey script for installing the build tools is outdated for node 22 because it still installs the vs2019 tools
I'm wondering if the best solution for this is to use WiX Toolset's features directly. I suspect it would be possible for it to download and install the necessary tools (with the same check box) without the PowerShell script.
However, I'm not very familiar with the WiX Toolset and am not sure quite where to start, or even how to test it...
Does anyone have a opinions on keeping the PowerShell script and changing it to use winget
vs using WiX Toolset to directly install the optional dependencies? Can someone speak to if WiX Toolset supports installing optional dependencies like this?
Edit: StackOverflow seems to suggest using a "Burn".
No idea about WiX, but I like the idea of winget
. I believe Win10 does not include winget
by default, so it would need to be installed. I think (not positive) Win11 does include winget
out of the box.
Windows 11 does include winget by default, AFAIK
Also, FWIW i think the following will work:
$progressPreference = 'silentlyContinue'
@REM # Check if winget is available
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
Write-Information "Winget not found. Downloading WinGet and its dependencies..."
# Download and install WinGet and its dependencies
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
}
@REM # Proceed with winget commands if winget is available
winget install Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended"
winget install Git.Git
winget install Python.Python.3.12
winget install NASM.NASM
I haven't tested it tho.
While the comments reference NASM
, the choco update ...
doesn't reference NASM... (nor git). We shouldn't be adding other dependencies, imho.
@RedYetiDev Why the --passive
and --wait
?
If you want to try it, push a PR (or fork and push to your own repo). The GitHub Actions will build a whole installer with the new script and you can test it.
I'd wait until winget comes standard with all builds
WinGet is (apparently) installed by default on recent versions of Windows 10... What more would you wait for?
I'm personally more partial to using WiX directly as that seems to align more with Windows standards that I'm familiar with.
Well, that's just my opinion
@nodejs/platform-windows WDYT
What is the problem this feature will solve?
Windows users are concerned by the check box in the installer (#30242) - why not remove the external dependency?
Chocolatey is an independent, open core (with proprietary extensions), package manager for Windows that recreates existing functionality included in all current versions of Windows. Chocolatey has its own set of problems, mostly stemming from the independent partially closed source for profit nature of the project.
What is the feature you are proposing to solve the problem?
winget
is an open source package manager from Microsoft and is installed by default on modern versions of Windows. It has all the packages that Chocolatey wants to install.This is equivalent to the checkbox, with newer package versions, and without Chocolatey:
What alternatives have you considered?
WiX Toolset, which is already in use, might have all the capabilities necessary to install these optional dependencies without using any PowerShell scripts.
Additional Resources