[Your Knowledge Wanted!!] How can Tasks in VS Code automate Claude Code activation in WSL terminal?

Resolved 💬 3 comments Opened Jun 17, 2025 by mickitty0511 Closed Jun 21, 2025

Problem Description

I'm trying to run Claude Code through VS Code's tasks.json configuration in a WSL environment, but getting a "command not found" error.

<img width="519" alt="Image" src="https://github.com/user-attachments/assets/3ed871f8-4166-4e77-91b8-27de7145271a" />

Environment

  • OS: Windows 11 with WSL2
  • WSL Distribution: Ubuntu-22.04
  • VS Code: Using tasks.json to run Claude in WSL terminal(* WSL terminal is the default terminal)

Current Configuration

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Run Claude in WSL Terminal",
            "type": "shell",
            "command": "claude",
            "options": {
                "shell": {
                    "executable": "wsl.exe",
                    "args": [
                        "-e",
                        "bash",
                        "-c"
                    ]
                }
            },
            "presentation": {
                "reveal": "always",
                "panel": "new"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": [],
            "runOptions": {
                "runOn": "folderOpen"
            }
        }
    ]
}

Error Output

bash: line 1: claude: command not found
The terminal process "wsl.exe -e bash -c claude" terminated with exit code: 127.

Attempted Solutions

I've checked the following:

  • Node.js and npm are properly installed in WSL
  • Tried running which claude, then get a proper result "/home/[username]/.nvm/versions/node/v22.16.0/bin/claude"

I'm new to using tasks in VS Code.
Any guidance on the proper setup would be greatly appreciated!

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗