継続は力なり

タイトル通り定期的な更新を心掛けるブログです。

Claude Code のアップデートを行おうとしてエラーが発生した時の対処メモ✍

タダです.

Claude Code むっちゃ便利でよく使っています.この記事では Claude Code を起動したときにバージョンアップを行う必要が出た際の対応を備忘録でまとめます.

Claude Code を起動した時にアップデートを促すメッセージが出現

Claude Code を起動したときに以下のアップデートを促すメッセージが出現し,Claude Code を起動できない状態になっていました.

$ claude
~中略~
 Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead.

It looks like your version of Claude Code (1.0.5) needs an update.
A newer version (1.0.24 or higher) is required to continue.

To update, please run:
    claude update

This will ensure you have access to the latest features and improvements.
~中略~
$

ターミナルに表示されたコマンド claude update を試しに実行してみたもののパーミッション周りでエラーがでて解消しませんでした...

claude update
Current version: 1.0.5
Checking for updates...
New version available: 1.0.35 (current: 1.0.5)
Installing update...
Using global installation update method...
Error: Insufficient permissions to install update
Try running with sudo or fix npm permissions
Or consider migrating to a local installation with:
  /migrate-installer

エラーが解消した対処

色々試したのですが npm update -g @anthropic-ai/claude-code で解消しました.

$ npm update -g @anthropic-ai/claude-code

changed 1 package in 6s
$ claude
~中略~
 What's new:
  • Added --add-dir CLI argument for specifying additional working directories
  • Added streaming input support without require -p flag
  • Improved startup performance and session storage performance
  • Added CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR environment variable to freeze working directory for bash commands
  • Added detailed MCP server tools display (/mcp)

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Try "how does <filepath> work?"                                                                                                                         │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

まとめ

Claude Code のアップデートをした時の対処を備忘録でまとめました.