win10系统升级claude code版本
查看本地版本和远程可以更新的版本
ICHUNT@DESKTOP-HASKQSO F:\wwwroot\pur (master)>claude --version 2.1.226 (Claude Code) ICHUNT@DESKTOP-HASKQSO F:\wwwroot\pur (master)>npm view @anthropic-ai/claude-code version 2.1.267 npm notice npm notice New major version of npm available! 10.9.7 -> 12.0.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.0.2 npm notice To update run: npm install -g npm@12.0.2 npm notice
执行更新命名前先关闭本地所有claude code客户端
npm install -g @anthropic-ai/claude-code@latest
注意:
-g参数表示全局更新,确保系统任何路径下都能使用新版本。@latest标签会拉取 GitHub 上发布的最新稳定版(即 v2.1.258)。
验证版本是否更新成功:
升级完成后,运行以下命令检查当前版本号:
claude --version
ICHUNT@DESKTOP-HASKQSO F:\wwwroot\pur (master)> npm install -g @anthropic-ai/claude-code@latest npm warn cleanup Failed to remove some directories [ npm warn cleanup [ npm warn cleanup 'F:\\Users\\ICHUNT\\Roaming\\npm\\node_modules\\@anthropic-ai\\.claude-code-trVYgj5B', npm warn cleanup [Error: EPERM: operation not permitted, unlink 'F:\Users\ICHUNT\Roaming\npm\node_modules\@anthropic-ai\.claude-code-trVYgj5B\node_modules\@anthropic-ai\claude-code-win32-x64\claude.exe'] {npm warn cleanup errno: -4048, npm warn cleanup code: 'EPERM', npm warn cleanup syscall: 'unlink', npm warn cleanup path: 'F:\\Users\\ICHUNT\\Roaming\\npm\\node_modules\\@anthropic-ai\\.claude-code-trVYgj5B\\node_modules\\@anthropic-ai\\claude-code-win32-x64\\claude.exe' npm warn cleanup } npm warn cleanup ] npm warn cleanup ] changed 2 packages in 11s ICHUNT@DESKTOP-HASKQSO F:\wwwroot\pur (master)> claude --version 2.1.267 (Claude Code)
报错是因为还有claude code客户端没有关闭
确保没有进程占用后,再次运行升级命令。建议加上 --force 以确保覆盖:
npm install -g @anthropic-ai/claude-code@latest --force

本文来自博客园,作者:孙龙-程序员,转载请注明原文链接:https://www.cnblogs.com/sunlong88/p/22920496
浙公网安备 33010602011771号