Skip to content
Latchkey

Azure Pipelines npm/dotnet Task - Tool Not Found

An Npm@1/DotNetCoreCLI@2 task (or a script calling npm/dotnet) could not find the tool. The SDK is not installed on the agent, the wrong version is on PATH, or the version-setup task was omitted or ordered after the use.

What this error means

The task fails reporting the tool could not be located, or a script prints npm: command not found / dotnet: command not found. On hosted agents this usually means a missing or mis-ordered setup task; on self-hosted, a missing install.

azure-pipelines
##[error]Unable to locate executable file: 'dotnet'.
+ npm ci
npm: command not found

Common causes

SDK not installed or wrong version on PATH

Self-hosted agents need the tool installed. Hosted agents have many SDKs, but the version you need may require an explicit setup task to put it on PATH.

Setup task missing or ordered after use

A UseDotNet@2/NodeTool@0 task that selects the version must run before any task or script that uses the tool. Omitting it, or placing it later, leaves the tool unresolved.

How to fix it

Install/select the tool version before using it

Run the version-setup task first so the tool is on PATH for later steps.

azure-pipelines.yml
steps:
  - task: UseDotNet@2
    inputs:
      version: '8.x'
  - task: NodeTool@0
    inputs:
      versionSpec: '20.x'
  - script: |
      dotnet --version
      npm ci

Provision the tool on self-hosted agents

  1. Install the required SDK/runtime on the self-hosted agent host.
  2. Confirm it is on the agent service's PATH (restart the agent after install).
  3. Pin the version with a setup task so runs are reproducible.

How to prevent it

  • Place version-setup tasks before any task or script that uses the tool.
  • Provision required SDKs on self-hosted agents and restart the service.
  • Pin tool versions so runs are reproducible across image rollouts.

Frequently asked questions

What causes ""tool not found""?
Self-hosted agents need the tool installed. Hosted agents have many SDKs, but the version you need may require an explicit setup task to put it on PATH.
How do I fix "tool not found"?
Run the version-setup task first so the tool is on PATH for later steps.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card