From 22e0bbc0689279d7d0b10d06cd7f3289c58be6ed Mon Sep 17 00:00:00 2001 From: "Earl Tankard, Jr., Ph.D" <45021016+primetimetank21@users.noreply.github.com> Date: Mon, 8 Jun 2026 04:05:40 -0400 Subject: [PATCH 1/3] fix(dev-config): activate Node via nvm instead of conflicting MSI (#55) dev-config.winget installed both OpenJS.NodeJS.LTS (MSI) and CoreyButler.NVMforWindows, but never ran nvm install / nvm use. nvm4w owns the front of PATH via the C:\nvm4w\nodejs junction, which pointed at nothing, so node failed with "command not found" in new terminals. - Remove the OpenJS.NodeJS.LTS MSI resource (ends the PATH race) - Keep CoreyButler.NVMforWindows as the canonical Node manager - Add an NvmActivateNode DSC script that runs nvm install 24 + nvm use 24, refreshing PATH before and after so Node 24 is active for later steps - Update both READMEs (13 -> 12 apps) Node is pinned to major 24 to match the cli-checks.ps1 ^v24. assertion. Co-authored-by: Copilot <223556219+copilot@users.noreply.github.com> --- src/windows-dev-config/README.md | 11 +++--- src/windows-dev-config/dev-config.winget | 49 +++++++++++++++++++----- windows-dev-config/README.md | 11 +++--- windows-dev-config/dev-config.winget | 49 +++++++++++++++++++----- 4 files changed, 90 insertions(+), 30 deletions(-) diff --git a/src/windows-dev-config/README.md b/src/windows-dev-config/README.md index 2dfb9ce..afa0b60 100644 --- a/src/windows-dev-config/README.md +++ b/src/windows-dev-config/README.md @@ -105,7 +105,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any ## What this configures -- **13 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, Node.js LTS, NVM for Windows, Windows Application CLI, plus optional Oh My Posh and PowerToys). +- **12 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI, plus optional Oh My Posh and PowerToys). - **WSL + Ubuntu**, installed via 3 transitional script resources that bracket a reboot (Phase 2/3/4 below). - **~24 registry settings** for theme/OS, Explorer, Taskbar, Search, Start, Notifications, Edge, Sudo, and the Widget service. - **Cascadia Code & Cascadia Mono Nerd Fonts** downloaded from the `microsoft/cascadia-code` GitHub release and registered per-user. @@ -123,7 +123,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any All resources are dscv3 (`$schema: .../DSC/main/schemas/2023/08/config/document.json`, `metadata.winget.processor.identifier: dscv3`). Every resource that touches HKLM or runs elevated tools depends on `ElevationCheck`. -Package resources use `Microsoft.WinGet/Package` with `source: winget` and `useLatest: true` (except `Python.Python.3.14`, `Microsoft.dotnet.SDK.10`, and `OpenJS.NodeJS.LTS`, which are pinned by id). +Package resources use `Microsoft.WinGet/Package` with `source: winget` and `useLatest: true` (except `Python.Python.3.14` and `Microsoft.dotnet.SDK.10`, which are pinned by id). Node 24 is activated via nvm (`NvmActivateNode`). ### Phase resources (elevation + WSL) @@ -148,8 +148,7 @@ All app resources that need WSL present depend on `InstallUbuntu` so the OS work | `DotnetSdk` | `Microsoft.dotnet.SDK.10` | Pinned to v10. | | `Python` | `Python.Python.3.14` | Pinned to 3.14. | | `UV` | `astral-sh.uv` | | -| `NodeJS` | `OpenJS.NodeJS.LTS` | Pinned to the LTS line (currently Node 24 LTS). | -| `nvmForNode` | `CoreyButler.NVMforWindows` | Node version manager for Windows. | +| `nvmForNode` | `CoreyButler.NVMforWindows` | Node version manager for Windows. `NvmActivateNode` runs `nvm install 24` + `nvm use 24` after install. | | `OhMyPosh` | `JanDeDobbeleer.OhMyPosh` | Marked Optional in the comments. Triggers `ohMyPoshProfileSet`. | | `winappCli` | `Microsoft.winappcli` | Windows Application CLI. | | `PowerToys` | `Microsoft.PowerToys` | Marked Optional. Followed by `PowerToysAOT` which disables AOT notifications via registry. | @@ -242,7 +241,7 @@ HKLM policies, applied via `Microsoft.Windows/Registry`: ## Customization - **Pick and choose packages.** Comment out any `Microsoft.WinGet/Package` block to skip that install — most have no `dependsOn` chain beyond `InstallUbuntu` (exceptions: `GitHubCLI` and `GitHubCopilot` depend on `Git`; `PowerToysAOT` depends on `PowerToys`; `ohMyPoshProfileSet` depends on `OhMyPosh`). -- **Pin or unpin versions.** Switch `id: Python.Python.3.14` (pinned) to `id: Python.Python.3` if you want to drift forward, or switch `OpenJS.NodeJS.LTS` to `OpenJS.NodeJS` for current. Vice versa for the unpinned packages. +- **Pin or unpin versions.** Switch `id: Python.Python.3.14` (pinned) to `id: Python.Python.3` if you want to drift forward. Vice versa for other unpinned packages. To change the activated Node version, update the `nvm install` and `nvm use` arguments in `NvmActivateNode`. - **Toggle registry values.** Most settings are `DWord: 0` or `DWord: 1`; flip the value to invert the behavior. - **Re-enable commented-out tweaks.** `HideDesktopIcons` ships commented out (it over-fires on some user setups). Uncomment to enable. - **Change the WSL distro.** Edit the `wsl --install -d Ubuntu --no-launch` line inside the `InstallUbuntu` resource. @@ -258,7 +257,7 @@ HKLM policies, applied via `Microsoft.Windows/Registry`: | `Microsoft.DSC.Transitional/WindowsPowerShellScript` (not `PSDscResources/Script`) | The dscv3 transitional resource is the supported equivalent under the new processor. | | Self-relaunch elevated from `ElevationCheck` | A user can double-click into an unelevated shell and the DSC will UAC-prompt itself rather than failing. | | Reboot + RunOnce inside the DSC | The DSC owns the reboot and the resume, so the user only invokes `winget configure` once. The throw after `Restart-Computer -Force` is required because `Restart-Computer` returns immediately after signalling shutdown; without the throw DSC would treat the resource as succeeded and continue. | -| `useLatest: true` on most packages | Cloud PC parity tracks "current" tools. Pinned ids (`Python.Python.3.14`, `Microsoft.dotnet.SDK.10`, `OpenJS.NodeJS.LTS`) are used where a major-version line matters. | +| `useLatest: true` on most packages | Cloud PC parity tracks "current" tools. Pinned ids (`Python.Python.3.14`, `Microsoft.dotnet.SDK.10`) are used where a major-version line matters. Node version is pinned explicitly in the `NvmActivateNode` activation script (`nvm install 24`). | | Dark theme via `dark.theme` file (not registry) | Applying the shipped `.theme` file flips both `AppsUseLightTheme` and `SystemUsesLightTheme` *and* applies the matching color scheme/cursors atomically, which the broadcast-message dance you'd otherwise need from a registry-only approach often misses. | | Per-user font install | Avoids requiring admin for the font step and keeps the font registration under `HKCU`, which is what modern Windows + Terminal expect. | | `RunCommandOnSet` to mutate `settings.json` | Windows Terminal's settings are JSON-based and not registry-mapped; a small pwsh fragment is the cleanest way. | diff --git a/src/windows-dev-config/dev-config.winget b/src/windows-dev-config/dev-config.winget index 82983be..7c7008c 100644 --- a/src/windows-dev-config/dev-config.winget +++ b/src/windows-dev-config/dev-config.winget @@ -690,23 +690,54 @@ resources: securityContext: elevated - type: Microsoft.WinGet/Package - name: NodeJS + name: nvmForNode properties: - id: OpenJS.NodeJS.LTS + id: CoreyButler.NVMforWindows source: winget useLatest: true metadata: - description: Install Node.js 24 LTS + description: Install NVM securityContext: elevated -- type: Microsoft.WinGet/Package - name: nvmForNode +- type: Microsoft.DSC.Transitional/PowerShellScript + name: NvmActivateNode + dependsOn: + - nvmForNode properties: - id: CoreyButler.NVMforWindows - source: winget - useLatest: true + getScript: | + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) + $ver = node --version 2>$null + return @{ nvm = $nvmOk; nodeVersion = [string]$ver } + testScript: | + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) + $nodeOk = (node --version 2>$null) -match '^v24\.' + return ($nvmOk -and $nodeOk) + setScript: | + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + if (-not (Get-Command nvm -ErrorAction SilentlyContinue)) { + throw 'nvm not on PATH. Verify CoreyButler.NVMforWindows installed correctly.' + } + + & nvm install 24 + if ($LASTEXITCODE -ne 0) { throw "nvm install 24 failed (exit $LASTEXITCODE)" } + & nvm use 24 + if ($LASTEXITCODE -ne 0) { throw "nvm use 24 failed (exit $LASTEXITCODE)" } + + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + + Write-Host "node $(node --version) activated via nvm" metadata: - description: Install NVM + description: Activate Node 24 LTS via nvm (nvm install 24 + nvm use 24) securityContext: elevated - type: Microsoft.WinGet/Package diff --git a/windows-dev-config/README.md b/windows-dev-config/README.md index 70b62a2..3086288 100644 --- a/windows-dev-config/README.md +++ b/windows-dev-config/README.md @@ -66,7 +66,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any ## What this configures -- **13 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, Node.js LTS, NVM for Windows, Windows Application CLI, plus optional Oh My Posh and PowerToys). +- **12 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI, plus optional Oh My Posh and PowerToys). - **WSL + Ubuntu**, installed via 3 transitional script resources that bracket a reboot (Phase 2/3/4 below). - **~24 registry settings** for theme/OS, Explorer, Taskbar, Search, Start, Notifications, Edge, Sudo, and the Widget service. - **Cascadia Code & Cascadia Mono Nerd Fonts** downloaded from the `microsoft/cascadia-code` GitHub release and registered per-user. @@ -84,7 +84,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any All resources are dscv3 (`$schema: .../DSC/main/schemas/2023/08/config/document.json`, `metadata.winget.processor.identifier: dscv3`). Every resource that touches HKLM or runs elevated tools depends on `ElevationCheck`. -Package resources use `Microsoft.WinGet/Package` with `source: winget` and `useLatest: true` (except `Python.Python.3.14`, `Microsoft.dotnet.SDK.10`, and `OpenJS.NodeJS.LTS`, which are pinned by id). +Package resources use `Microsoft.WinGet/Package` with `source: winget` and `useLatest: true` (except `Python.Python.3.14` and `Microsoft.dotnet.SDK.10`, which are pinned by id). Node 24 is activated via nvm (`NvmActivateNode`). ### Phase resources (elevation + WSL) @@ -109,8 +109,7 @@ All app resources that need WSL present depend on `InstallUbuntu` so the OS work | `DotnetSdk` | `Microsoft.dotnet.SDK.10` | Pinned to v10. | | `Python` | `Python.Python.3.14` | Pinned to 3.14. | | `UV` | `astral-sh.uv` | | -| `NodeJS` | `OpenJS.NodeJS.LTS` | Pinned to the LTS line (currently Node 24 LTS). | -| `nvmForNode` | `CoreyButler.NVMforWindows` | Node version manager for Windows. | +| `nvmForNode` | `CoreyButler.NVMforWindows` | Node version manager for Windows. `NvmActivateNode` runs `nvm install 24` + `nvm use 24` after install. | | `OhMyPosh` | `JanDeDobbeleer.OhMyPosh` | Marked Optional in the comments. Triggers `ohMyPoshProfileSet`. | | `winappCli` | `Microsoft.winappcli` | Windows Application CLI. | | `PowerToys` | `Microsoft.PowerToys` | Marked Optional. Followed by `PowerToysAOT` which disables AOT notifications via registry. | @@ -203,7 +202,7 @@ HKLM policies, applied via `Microsoft.Windows/Registry`: ## Customization - **Pick and choose packages.** Comment out any `Microsoft.WinGet/Package` block to skip that install — most have no `dependsOn` chain beyond `InstallUbuntu` (exceptions: `GitHubCLI` and `GitHubCopilot` depend on `Git`; `PowerToysAOT` depends on `PowerToys`; `ohMyPoshProfileSet` depends on `OhMyPosh`). -- **Pin or unpin versions.** Switch `id: Python.Python.3.14` (pinned) to `id: Python.Python.3` if you want to drift forward, or switch `OpenJS.NodeJS.LTS` to `OpenJS.NodeJS` for current. Vice versa for the unpinned packages. +- **Pin or unpin versions.** Switch `id: Python.Python.3.14` (pinned) to `id: Python.Python.3` if you want to drift forward. Vice versa for other unpinned packages. To change the activated Node version, update the `nvm install` and `nvm use` arguments in `NvmActivateNode`. - **Toggle registry values.** Most settings are `DWord: 0` or `DWord: 1`; flip the value to invert the behavior. - **Re-enable commented-out tweaks.** `HideDesktopIcons` ships commented out (it over-fires on some user setups). Uncomment to enable. - **Change the WSL distro.** Edit the `wsl --install -d Ubuntu --no-launch` line inside the `InstallUbuntu` resource. @@ -219,7 +218,7 @@ HKLM policies, applied via `Microsoft.Windows/Registry`: | `Microsoft.DSC.Transitional/WindowsPowerShellScript` (not `PSDscResources/Script`) | The dscv3 transitional resource is the supported equivalent under the new processor. | | Self-relaunch elevated from `ElevationCheck` | A user can double-click into an unelevated shell and the DSC will UAC-prompt itself rather than failing. | | Reboot + RunOnce inside the DSC | The DSC owns the reboot and the resume, so the user only invokes `winget configure` once. The throw after `Restart-Computer -Force` is required because `Restart-Computer` returns immediately after signalling shutdown; without the throw DSC would treat the resource as succeeded and continue. | -| `useLatest: true` on most packages | Cloud PC parity tracks "current" tools. Pinned ids (`Python.Python.3.14`, `Microsoft.dotnet.SDK.10`, `OpenJS.NodeJS.LTS`) are used where a major-version line matters. | +| `useLatest: true` on most packages | Cloud PC parity tracks "current" tools. Pinned ids (`Python.Python.3.14`, `Microsoft.dotnet.SDK.10`) are used where a major-version line matters. Node version is pinned explicitly in the `NvmActivateNode` activation script (`nvm install 24`). | | Dark theme via `dark.theme` file (not registry) | Applying the shipped `.theme` file flips both `AppsUseLightTheme` and `SystemUsesLightTheme` *and* applies the matching color scheme/cursors atomically, which the broadcast-message dance you'd otherwise need from a registry-only approach often misses. | | Per-user font install | Avoids requiring admin for the font step and keeps the font registration under `HKCU`, which is what modern Windows + Terminal expect. | | `RunCommandOnSet` to mutate `settings.json` | Windows Terminal's settings are JSON-based and not registry-mapped; a small pwsh fragment is the cleanest way. | diff --git a/windows-dev-config/dev-config.winget b/windows-dev-config/dev-config.winget index 82983be..7c7008c 100644 --- a/windows-dev-config/dev-config.winget +++ b/windows-dev-config/dev-config.winget @@ -690,23 +690,54 @@ resources: securityContext: elevated - type: Microsoft.WinGet/Package - name: NodeJS + name: nvmForNode properties: - id: OpenJS.NodeJS.LTS + id: CoreyButler.NVMforWindows source: winget useLatest: true metadata: - description: Install Node.js 24 LTS + description: Install NVM securityContext: elevated -- type: Microsoft.WinGet/Package - name: nvmForNode +- type: Microsoft.DSC.Transitional/PowerShellScript + name: NvmActivateNode + dependsOn: + - nvmForNode properties: - id: CoreyButler.NVMforWindows - source: winget - useLatest: true + getScript: | + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) + $ver = node --version 2>$null + return @{ nvm = $nvmOk; nodeVersion = [string]$ver } + testScript: | + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) + $nodeOk = (node --version 2>$null) -match '^v24\.' + return ($nvmOk -and $nodeOk) + setScript: | + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + if (-not (Get-Command nvm -ErrorAction SilentlyContinue)) { + throw 'nvm not on PATH. Verify CoreyButler.NVMforWindows installed correctly.' + } + + & nvm install 24 + if ($LASTEXITCODE -ne 0) { throw "nvm install 24 failed (exit $LASTEXITCODE)" } + & nvm use 24 + if ($LASTEXITCODE -ne 0) { throw "nvm use 24 failed (exit $LASTEXITCODE)" } + + $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') + $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' + + Write-Host "node $(node --version) activated via nvm" metadata: - description: Install NVM + description: Activate Node 24 LTS via nvm (nvm install 24 + nvm use 24) securityContext: elevated - type: Microsoft.WinGet/Package From a334cdb5884d1d228f361ffad87c5b72d1669729 Mon Sep 17 00:00:00 2001 From: "Earl Tankard, Jr., Ph.D" <45021016+primetimetank21@users.noreply.github.com> Date: 2026年6月10日 00:25:03 -0400 Subject: [PATCH 2/3] fix(dev-config): address PR review feedback (#68) - NvmActivateNode: add PowerShell to dependsOn (matches file convention so pwsh 7 is present before the script runs) - Drop misleading "LTS" wording from the Node 24 activation description (script pins by major, not the lts alias) - README: add Windows Terminal to the app list and reframe the count as 11 core apps plus 2 optional (Oh My Posh, PowerToys) Co-authored-by: Copilot <223556219+copilot@users.noreply.github.com> --- src/windows-dev-config/README.md | 2 +- src/windows-dev-config/dev-config.winget | 3 ++- windows-dev-config/README.md | 2 +- windows-dev-config/dev-config.winget | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/windows-dev-config/README.md b/src/windows-dev-config/README.md index afa0b60..5e8c549 100644 --- a/src/windows-dev-config/README.md +++ b/src/windows-dev-config/README.md @@ -105,7 +105,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any ## What this configures -- **12 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI, plus optional Oh My Posh and PowerToys). +- **11 core apps** (plus 2 optional: Oh My Posh and PowerToys) via winget (Windows Terminal, PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI). - **WSL + Ubuntu**, installed via 3 transitional script resources that bracket a reboot (Phase 2/3/4 below). - **~24 registry settings** for theme/OS, Explorer, Taskbar, Search, Start, Notifications, Edge, Sudo, and the Widget service. - **Cascadia Code & Cascadia Mono Nerd Fonts** downloaded from the `microsoft/cascadia-code` GitHub release and registered per-user. diff --git a/src/windows-dev-config/dev-config.winget b/src/windows-dev-config/dev-config.winget index 7c7008c..460461e 100644 --- a/src/windows-dev-config/dev-config.winget +++ b/src/windows-dev-config/dev-config.winget @@ -702,6 +702,7 @@ resources: - type: Microsoft.DSC.Transitional/PowerShellScript name: NvmActivateNode dependsOn: + - PowerShell - nvmForNode properties: getScript: | @@ -737,7 +738,7 @@ resources: Write-Host "node $(node --version) activated via nvm" metadata: - description: Activate Node 24 LTS via nvm (nvm install 24 + nvm use 24) + description: Activate Node 24 via nvm (nvm install 24 + nvm use 24) securityContext: elevated - type: Microsoft.WinGet/Package diff --git a/windows-dev-config/README.md b/windows-dev-config/README.md index 3086288..cb8e790 100644 --- a/windows-dev-config/README.md +++ b/windows-dev-config/README.md @@ -66,7 +66,7 @@ The configuration is idempotent, so it is safe to re-run after reboot or at any ## What this configures -- **12 apps** via winget (PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI, plus optional Oh My Posh and PowerToys). +- **11 core apps** (plus 2 optional: Oh My Posh and PowerToys) via winget (Windows Terminal, PowerShell 7, Git, GitHub CLI, GitHub Copilot CLI, VS Code, .NET SDK 10, Python 3.14, UV, NVM for Windows (activates Node 24), Windows Application CLI). - **WSL + Ubuntu**, installed via 3 transitional script resources that bracket a reboot (Phase 2/3/4 below). - **~24 registry settings** for theme/OS, Explorer, Taskbar, Search, Start, Notifications, Edge, Sudo, and the Widget service. - **Cascadia Code & Cascadia Mono Nerd Fonts** downloaded from the `microsoft/cascadia-code` GitHub release and registered per-user. diff --git a/windows-dev-config/dev-config.winget b/windows-dev-config/dev-config.winget index 7c7008c..460461e 100644 --- a/windows-dev-config/dev-config.winget +++ b/windows-dev-config/dev-config.winget @@ -702,6 +702,7 @@ resources: - type: Microsoft.DSC.Transitional/PowerShellScript name: NvmActivateNode dependsOn: + - PowerShell - nvmForNode properties: getScript: | @@ -737,7 +738,7 @@ resources: Write-Host "node $(node --version) activated via nvm" metadata: - description: Activate Node 24 LTS via nvm (nvm install 24 + nvm use 24) + description: Activate Node 24 via nvm (nvm install 24 + nvm use 24) securityContext: elevated - type: Microsoft.WinGet/Package From b1007d831f5d15727db857bf55fc8d36b02ebfcf Mon Sep 17 00:00:00 2001 From: "Earl Tankard, Jr., Ph.D" <45021016+primetimetank21@users.noreply.github.com> Date: 2026年6月12日 02:08:44 -0400 Subject: [PATCH 3/3] fix(dev-config): guard node calls and use Write-Information in NvmActivateNode Addresses Copilot review on #68: - Guard node --version with Get-Command in getScript/testScript so the DSC run doesn't throw before Node is activated. - Switch the activation log line from Write-Host to Write-Information. Applied to both mirror config files. Co-authored-by: Copilot <223556219+copilot@users.noreply.github.com> --- src/windows-dev-config/dev-config.winget | 6 +++--- windows-dev-config/dev-config.winget | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/windows-dev-config/dev-config.winget b/src/windows-dev-config/dev-config.winget index 460461e..c512958 100644 --- a/src/windows-dev-config/dev-config.winget +++ b/src/windows-dev-config/dev-config.winget @@ -710,14 +710,14 @@ resources: $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) - $ver = node --version 2>$null + $ver = if (Get-Command node -ErrorAction SilentlyContinue) { node --version 2>$null } else { '' } return @{ nvm = $nvmOk; nodeVersion = [string]$ver } testScript: | $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) - $nodeOk = (node --version 2>$null) -match '^v24\.' + $nodeOk = (Get-Command node -ErrorAction SilentlyContinue) -and ((node --version 2>$null) -match '^v24\.') return ($nvmOk -and $nodeOk) setScript: | $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') @@ -736,7 +736,7 @@ resources: $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' - Write-Host "node $(node --version) activated via nvm" + Write-Information "node $(node --version) activated via nvm" -InformationAction Continue metadata: description: Activate Node 24 via nvm (nvm install 24 + nvm use 24) securityContext: elevated diff --git a/windows-dev-config/dev-config.winget b/windows-dev-config/dev-config.winget index 460461e..c512958 100644 --- a/windows-dev-config/dev-config.winget +++ b/windows-dev-config/dev-config.winget @@ -710,14 +710,14 @@ resources: $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) - $ver = node --version 2>$null + $ver = if (Get-Command node -ErrorAction SilentlyContinue) { node --version 2>$null } else { '' } return @{ nvm = $nvmOk; nodeVersion = [string]$ver } testScript: | $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' $nvmOk = $null -ne (Get-Command nvm -ErrorAction SilentlyContinue) - $nodeOk = (node --version 2>$null) -match '^v24\.' + $nodeOk = (Get-Command node -ErrorAction SilentlyContinue) -and ((node --version 2>$null) -match '^v24\.') return ($nvmOk -and $nodeOk) setScript: | $machine = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') @@ -736,7 +736,7 @@ resources: $user = [System.Environment]::GetEnvironmentVariable('Path', 'User') $env:Path = (($machine, $user) | Where-Object { $_ }) -join ';' - Write-Host "node $(node --version) activated via nvm" + Write-Information "node $(node --version) activated via nvm" -InformationAction Continue metadata: description: Activate Node 24 via nvm (nvm install 24 + nvm use 24) securityContext: elevated