Migrating Claude Code from npm Global Install to Native Install
This article explains how to migrate Claude Code from npm global install to native install.
When launching Claude Code, the following message was displayed:
Claude Code has switched from npm to native installer. Run
claude installor see https://docs.anthropic.com/en/docs/claude-code/getting-started for more options.
This means that Claude Code, which was previously installed via Node.js package manager (npm) using npm install -g @anthropic-ai/claude-code, has now switched to using a dedicated native installer.
The migration to the native installer offers the following benefits:
Following the instructions and running claude install will install the native version to ~/.local/bin/claude.
However, in environments where Node.js is managed with asdf, running which claude may still prioritize the asdf shim (~/.asdf/shims/claude), causing the old npm version to continue being called.
The following steps will resolve this issue.
asdf list nodejsWith asdf, global packages are managed per Node.js version. Therefore, you need to uninstall @anthropic-ai/claude-code from all versions you’ve used in the past.
One-liner to execute in batch:
for version in $(asdf list nodejs | tr -d ' *'); do
echo "Uninstalling from nodejs $version..."
ASDF_NODEJS_VERSION=$version npm uninstall -g @anthropic-ai/claude-code 2>/dev/null
doneasdf reshim nodejsIf the shim still remains after the above steps, delete it manually.
rm -f ~/.asdf/shims/claudewhich claude
# Expected: /Users/<username>/.local/bin/claude
claude --versionIf ~/.local/bin/claude is displayed, the native installer version is being used correctly.
If ~/.local/bin is set after asdf shims in your PATH, check and adjust the order in your shell configuration file (.zshrc or .bashrc).
# Load ~/.local/bin first
export PATH="$HOME/.local/bin:$PATH"After making changes, restart your shell or run source ~/.zshrc to apply the settings.
With Claude Code’s migration to the native installer, the dependency on Node.js environment has been removed, making it simpler to use.
asdf users need to be aware of the shim priority issue, but following the steps in this article will ensure a smooth migration.
For more details, refer to the Claude Code official documentation.
That’s all from the Gemba, where we migrated Claude Code to native install.