Installing Claude Code
Module: Getting Started | Lesson: 3 of 6 | Time: ~10 minutes
What You Will Learn
- How to install Claude Code using npm
- How to verify the installation succeeded
- How to update Claude Code in the future
- How to troubleshoot common installation issues on Windows
Prerequisites
- Completed Installing Prerequisites (Node.js and npm are installed)
Installing Claude Code
First, open PowerShell. If you do not remember how:
- Press Win+X and choose Terminal (or Windows PowerShell)
- Or search for "PowerShell" in the Start menu
Once you have a PowerShell window open, type the following command and press Enter:
npm install -g @anthropic-ai/claude-code
Let's break down what each piece means:
| Part | Meaning |
|---|---|
npm | Node's package manager — the tool that downloads and installs JavaScript packages |
install | Tells npm you want to install something |
-g | Install globally — this makes Claude Code available everywhere on your computer, not just in one folder |
@anthropic-ai/claude-code | The name of the package to install (published by Anthropic) |
What to expect during installation
The installation will show a progress bar and some text scrolling by. Here is what is normal:
- It may take a minute or two — be patient.
- You will likely see lines that start with
WARN— these are warnings and are completely normal. Ignore them. - Only lines that start with
ERR!indicate an actual problem.
If the installation seems to hang for a long time, don't close the window. npm sometimes pauses while resolving dependencies. Give it up to five minutes before assuming something is wrong.
When installation finishes, you will see a summary of what was installed and the command prompt will return.
Verifying the Installation
After installation completes, run:
claude --version
You should see a version number printed, something like:
1.0.21
The exact number does not matter — what matters is that you see a version number and not an error. If you see a version number, Claude Code is installed and ready.
If you see an error like "claude is not recognized," don't panic. Jump down to the Troubleshooting section below.
Updating Claude Code (For Future Reference)
Claude Code gets updated regularly with new features and fixes. When you want to update to the latest version in the future, run:
npm update -g @anthropic-ai/claude-code
You do not need to do this right now — just keep this command in mind for later.
Alternative Installation Method
If you prefer a one-liner that handles everything automatically, you can use this PowerShell command instead:
irm https://claude.ai/install.ps1 | iex
This downloads and runs Anthropic's official install script.
Both methods (npm install and the PowerShell one-liner) produce the same result. Pick whichever you are more comfortable with. If you already ran the npm command above, you do not need to run this one too.
Troubleshooting
"claude is not recognized as the name of a cmdlet"
This is the most common issue. It means PowerShell cannot find the claude command.
Step 1: Close and reopen PowerShell. Sometimes the PATH is updated during installation but your current PowerShell session does not know about it yet. Close your PowerShell window entirely, open a new one, and try claude --version again.
Step 2: If it still does not work, check your PATH. Run this command:
npm config get prefix
This will print a path, something like C:\Users\YourName\AppData\Roaming\npm. The claude command lives inside that folder. You need to make sure that folder is in your system's PATH.
How to add it to PATH:
- Press Win+S and search for "Environment Variables"
- Click "Edit the system environment variables"
- In the System Properties window, click the "Environment Variables..." button
- Under "User variables" (the top section), find the variable named Path and double-click it
- Click "New" and paste the path you got from
npm config get prefix - Click OK on all open windows
- Close and reopen PowerShell
- Try
claude --versionagain
After editing environment variables, you must close and reopen PowerShell for the changes to take effect. Existing windows will not pick up the change.
Permission errors
If you see errors about permissions being denied:
- Close PowerShell
- Right-click on PowerShell (or Terminal) in the Start menu
- Choose "Run as administrator"
- Try the install command again
Slow installation
A slow install is normal, especially on the first run. npm needs to download Claude Code and all of its dependencies. If you are on a slower internet connection, it can take several minutes. Be patient and let it finish.
Behind a corporate proxy
If you are on a corporate or school network that uses a proxy, npm may not be able to reach the internet. You may need to configure npm to use your proxy:
npm config set proxy http://your-proxy-address:port
npm config set https-proxy http://your-proxy-address:port
Ask your IT department for the correct proxy address if you are unsure.
Try It Yourself
Run the following command in PowerShell and confirm that you see a version number:
claude --version
If you see a version number, you are ready to move on. If you see an error, work through the Troubleshooting section above before continuing.
What You Learned
- Claude Code is installed globally using
npm install -g @anthropic-ai/claude-code - You verify the installation by running
claude --version - You can update later with
npm update -g @anthropic-ai/claude-code - The most common issue is a PATH problem, which you now know how to fix
How was this lesson? Take 2 minutes to share your feedback — it helps us make the tutorials better for everyone.