Claude Code 1.0.x安装

Claude Code:WSL 下安装失败(npm 操作系统不匹配)

npm error notsup Unsupported platform — wanted {"os":"linux"} (current: {"os":"win32"})
受影响版本
1.0.x
修复版本
最近验证
Claude Code 1.0.x

根因

在 WSL 内,npm 有时检测成 Windows 系统(或 Windows 装的 Node 覆盖了 Linux 版),导致平台相关包拒绝安装。

复现步骤

在 WSL2 Ubuntu 内安装 Claude Code,遇到 OS/平台不匹配错误。

解决方案 (2)

按社区投票排序。应用前请先确认验证版本。

41
#1适用版本 1.0.x

安装前让 npm 以 Linux 行为:`npm config set os linux`,然后在 WSL 内重新安装 Claude Code。

最近验证: Claude Code 1.0.x · community

22
#2适用版本 1.0.x

确保用的是 WSL 内(经 nvm 安装)的 Linux Node,而非 PATH 上的 Windows Node。用 `which node`、`which npm` 检查。

最近验证: Claude Code 1.0.x · community

来源

相关报错