microsoft / microsoft/WindowsDeveloperConfig

Conflict: dev-config installs nvm4w but TypeScript workload installs Node.js LTS directly

未关闭
#55 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
PowerShell
星标
2.2k
派生
168
平均合并
5 小时 14 分钟
30 天内合并 PR
5

描述

Summary

The main dev-config.winget installs NVM for Windows (CoreyButler.NVMforWindows), which manages Node.js versions via a symlink at C:\nvm4w\nodejs and adds that to PATH. However, the TypeScript workload (Workloads/typescript/configuration.winget) separately installs OpenJS.NodeJS.LTS directly via winget, which places Node at C:\Program Files\nodejs.

This creates a broken state where:

  1. PATH points to C:\nvm4w\nodejs (set by nvm4w)
  2. The nvm4w symlink targets a version directory (e.g. C:\Users\<user>\AppData\Local\nvm\v24.16.0) that does not exist because Node was installed via the MSI package, not through nvm install
  3. node and npm are not found on PATH despite Node.js being physically installed

Steps to Reproduce

  1. Apply the main windows-dev-config/dev-config.winget (installs nvm4w, adds C:\nvm4w\nodejs to PATH)
  2. Apply Workloads/typescript/configuration.winget (installs OpenJS.NodeJS.LTS to C:\Program Files\nodejs)
  3. Open a new terminal
  4. Run node --versioncommand not found

Root Cause

nvm4w owns the PATH entry (C:\nvm4w\nodejs) and expects Node to be installed via nvm install <version> + nvm use <version>. The direct winget install of OpenJS.NodeJS.LTS puts node elsewhere and nvm4w's symlink points to a non-existent directory.

Suggested Fix

Option A — TypeScript workload defers to nvm4w:
Replace the OpenJS.NodeJS.LTS winget package resource with a RunCommandOnSet that runs:

nvm install lts
nvm use lts

Option B — Remove nvm4w from dev-config, let workloads install Node directly:
Remove CoreyButler.NVMforWindows from dev-config.winget and ensure C:\Program Files\nodejs ends up on PATH (the Node MSI installer does this by default).

Option C — Keep both but coordinate PATH:
If both are intentional, the TypeScript workload should add C:\Program Files\nodejs to PATH explicitly, or the refresh-path.ps1 should detect and resolve the nvm4w symlink conflict.

Environment

  • Windows 11 (Build 2026)
  • winget v1.28.240
  • CoreyButler.NVMforWindows 1.2.2
  • OpenJS.NodeJS.22 24.16.0 (installed by winget as the LTS package)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

比较 dev-config.winget 与 Workloads/typescript/configuration.winget,然后在 PATH 处理属于所选方案一部分的情况下检查 refresh-path.ps1。在 Windows 上应用这两种配置,并验证在新终端中可以使用 node --version 和 npm,且不存在相互冲突的 Node 安装;所选的协调策略应明确且可复现。

由索引模型根据 Issue 内容生成。

评估

技术栈
node.js, powershell, typescript
领域
developer-experience, devops, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。