Command not found

Netlify Build Fails: Command Not Found – Fix Now

Server & Cloud Intermediate 👁 4 views 📅 Jun 22, 2026

Your Netlify build fails with 'command not found'. I'll show you the quick fix and why it happens. No fluff.

You're looking at a failed Netlify build, and the log says 'command not found'. I know this error is infuriating.

I've seen this hundreds of times. The fix is usually simple: your Netlify build environment doesn't know where your command lives. Let's get it sorted.

The Quick Fix

Open your netlify.toml file or your Netlify deploy settings. The problem is almost always in the build command. Here's what to check:

  1. Make sure your build command uses the full path or the correct package manager. For example, if you use npm commands, write npm run build — not just run build.
  2. If you're using Yarn, write yarn build. Netlify's default environment doesn't always have Yarn on the path unless you set it.
  3. Set your Node.js version in netlify.toml. Like this:
[build]
  command = "npm run build"
  publish = "dist"

[build.environment]
  NODE_VERSION = "18"

If you're still stuck, try changing your build command to use npx for local tools. For instance, npx vue-cli-service build instead of vue-cli-service build.

Why This Happens

Netlify runs your build in a clean Linux container. It has Node.js, npm, and a few other tools pre-installed. But if your project expects a specific package manager (like Yarn or pnpm) or a global CLI tool (like Gatsby, Hugo, or React Scripts), Netlify won't have them unless you tell it.

The 'command not found' error means the shell can't find the executable. This happens because:

  • Your build command references a global tool that isn't installed in the build environment.
  • Your package.json has scripts that call commands not in the PATH.
  • You're using Yarn 2+ (Berry) which uses yarn dlx instead of npx, and Netlify doesn't set it up automatically.

Less Common Variations

Sometimes the fix isn't in the build command. Here are a few real-world gotchas:

  • Monorepo issues: If your netlify.toml points to a subdirectory, the command might run from the wrong folder. Set base in the build section: base = "packages/frontend".
  • Private packages: If your build needs a private npm package, you need an .npmrc file with an auth token. Netlify won't ask for it — you must add it as an environment variable.
  • Hugo/Static site generators: You must set the HUGO_VERSION environment variable, or Netlify uses an old version that might not work with your project.
  • Python projects: Netlify supports Python builds, but you need to specify the runtime and install dependencies manually in the build command, like pip install -r requirements.txt.

How to Stop This Forever

Once you fix it, here's how to avoid hitting it again:

  1. Always pin your Node version in netlify.toml. Don't rely on the default — it changes over time and breaks builds.
  2. Test your build locally with the Netlify CLI. Run netlify build in your terminal to see if it works before you push.
  3. Use npx for local CLI tools that are in devDependencies. This avoids version conflicts and missing tools.
  4. Check your build logs the first time after a fix. Netlify shows the exact command it runs. If it looks wrong, you'll see it right there.

I've seen this error pop up after updating a project's package.json, switching package managers, or moving to a new Node major version. The fix is almost always in the build settings or environment variables. Now you know exactly where to look.

Was this solution helpful?