Books/Claude Code/Setup Claude Code

    Setup Claude Code

    Claude code needs few pre-requisites as mentioned below.

    Pre Requisite 1 - Node JS

    Node.js version 18 or higher

    Goto https://nodejs.org/en/download

    Download and install node, verify the vrsion of node and npm

    Check Node version after installation, it should be 18 or higher.

    node --version

    Also check npm version

    npm --version

    Pre Requisite 2 - Git

    Download Git for Windows from: https://git-scm.com/downloads/win

    Run the installer with default options (this includes git-bash)

    Pre Requisite 3 - Anthropic Subscription or API key

    Anthropic Subscription' Go to claude.ai, upgrade (https://claude.ai/upgrade) to Pro or Max.

    Anthropic Key: Go to console.anthropic.com, Create an account, Add Credits & Generate an API key

    Installation

    Now, you can install Claude Code

    npm install -g @anthropic-ai/claude-code

    npm install - we're installing a package

    -g - the "g" means GLOBAL, so we can use it from anywhere

    @anthropic-ai/claude-code - that's the official package name

    This will download and install claude-code package and necessary dependencies

    Usually takes about 30 seconds depending on your internet speed.

    After installation, check the claude version

    claude --version

    Authentication

    Post Installation, you can authenticate with Anthropic subscription or API key.

    claude auth login

    Your browser pops open, you log in to your Anthropic account, authorize the CLI, and boom - you're done. You'll see a success message in your terminal.

    If seamless authentication with browser flow does not happen, you get the Anthropic API key and login in terminal.

    claude auth login --api-key YOUR_KEY_HERE

    After Authentication, you are all set.

    Video Tutorial


    🌐 www.genai-mentor.ai