Skip to content
Happy Programming Guide
Start learning
AI for Programmers

Claude Code Not Working in VS Code or the Terminal

The claude command is not found, sign-in loops, or the VS Code extension shows nothing? The causes in order: Node and PATH, authentication, shell, then the IDE integration.

A ladybird resting on a green leaf

Claude Code is a terminal program first and an editor integration second, so when it stops working the terminal is where to look. The causes, in order of how often they turn up: the claude command is not on the PATH, the installed Node is too old, sign-in did not complete, the shell on Windows is not one it supports, or the VS Code extension cannot find the command-line tool it wraps. Each has a two-minute check.

Step 1: is it installed and findable?#

Terminal
node --version          # needs a current LTS; 18 is the minimum, 20 or newer is better
npm --version
claude --version        # the thing that is failing
which claude            # macOS/Linux
where.exe claude        # Windows

If claude --version says command not found but the install reported success, npm’s global bin folder is not on your PATH. Find it:

Terminal
npm config get prefix
# macOS/Linux: add <prefix>/bin to PATH
# Windows: add <prefix> itself (usually %APPDATA%\npm)

This is the most common cause on a fresh machine, and on any machine where Node was installed with a version manager after Claude Code was installed — nvm, fnm and Volta each keep their own global folder per Node version, so switching Node versions makes globally installed commands vanish.

Terminal
# Reinstall into the Node version you are actually using
npm install -g @anthropic-ai/claude-code

The native installer, available for macOS, Linux and Windows, avoids the npm PATH problem entirely and is now the recommended route. If you keep hitting this, switch to it.

Step 2: authentication#

On first run Claude Code opens a browser to sign in. Failures look like a loop back to the sign-in prompt, or an “unauthorised” error on the first request.

  • Run claude and then /login inside it to restart the flow.
  • Complete the browser step in the same account you intend to use; a work and personal account signed into the browser at once is a classic cause of the wrong one being picked.
  • If the browser cannot reach back to the terminal (remote machines, containers), the sign-in flow shows a code to paste instead. Use that.
  • Check that the subscription or API access is active in the account settings; an expired plan looks like a broken tool.
Terminal
claude /status         # shows the account, model and where settings are coming from

If you set an ANTHROPIC_API_KEY environment variable, it takes precedence over the browser sign-in. A stale or wrong key in a shell profile explains many “I signed in but it still fails” cases; unset it and retry.

Step 3: the shell, on Windows#

Claude Code needs a POSIX-style shell for the commands it runs. On Windows that means Git for Windows, which provides Git Bash. Without it you will see errors about a missing shell, or commands failing with odd quoting problems.

  1. Install Git for Windows.
  2. If Claude Code cannot find it, set CLAUDE_CODE_GIT_BASH_PATH to the full path of bash.exe, typically under C:\Program Files\Git\bin.
  3. Open a new terminal window afterwards.

Running inside WSL is the other route, and for anything Linux-flavoured it is the smoother one: install Node and Claude Code inside the WSL distribution and run it from there.

Step 4: VS Code and Cursor#

The VS Code extension is a front end over the command-line tool. If the terminal works and the extension does not:

  • Make sure the extension and the CLI are both current; they move together.
  • Launch VS Code from a terminal where claude works, so it inherits the same PATH: code .. An editor started from the Dock or Start menu may have an older PATH.
  • Open the extension’s output channel — View, Output, then choose Claude Code — and read the first error.
  • Run Developer: Reload Window after any change.

In Cursor, the same extension generally works, since Cursor is VS Code underneath; the terminal route inside Cursor’s integrated terminal always works and is a good fallback. If the integrated terminal cannot find claude but a standalone one can, it is the PATH inheritance problem above.

“Not working with Ollama”#

Claude Code talks to Anthropic’s models. It does not connect to a local Ollama server out of the box, so a setup that points it at Ollama is using a third-party compatibility layer that translates between the two APIs. If that is what you are running:

  • Confirm the proxy is up and answering on the address you set in ANTHROPIC_BASE_URL.
  • Confirm the local model is one the proxy supports; tool-calling in particular needs a model that handles it.
  • Expect reduced quality. The agent’s planning and file-editing behaviour is tuned for the models it ships with.

When in doubt, unset the base-URL variable and confirm the tool works normally first. If it does, the problem is the proxy, not Claude Code.

Commands run but nothing happens#

A tool that starts, accepts a prompt, and then seems to hang is usually waiting for a permission you have not seen: a prompt to allow a command, an edit, or network access. Look at the terminal for a pending yes/no. In an editor, the prompt may be in a different panel from the one you are watching.

Questions people ask#

Do I need Node if I use the native installer?

No. The native installer bundles what it needs. Node is only required for the npm route.

Why does it work in one project and not another?

Project-level settings and permission rules live in a .claude folder. A restrictive or broken settings file in one project changes behaviour there only. Run /status inside that project to see which settings files are loaded.

Can I run it without a browser for sign-in?

Yes, with an API key in the environment, or by pasting the code shown when the browser cannot call back.

Is there a Windows-native version?

Yes, and it still needs Git for Windows for its shell. WSL is the alternative if you prefer a full Linux environment.

Where to go next#

Claude Code vs Codex: which coding agent to useRead next

Keep reading

Keep going — pick your next guide

The fastest way to improve is to read one guide, then build the thing it describes. Start with the basics, or jump straight to a project.

Ask a question or share what worked

Your email address will not be published. Required fields are marked *