ninja: error C/C++ Origin: Application & API OSI layer 7 · Application Last updated 2 Dec 2026

ninja: error: loading 'build.ninja': No such file or directory

Ninja was run in a directory that has no build.ninja file.

Exact message you may see loading 'build.ninja': No such file or directoryninja: error loading build.ninjaninja build.ninja not found
Seen on: Ninja CMake

Meaning

Ninja needs a generated file from CMake or Meson. Running it from the source folder, or before configuration, finds nothing.

Common causes

  • Wrong directory
  • Configuration not run yet
  • Generator was Makefiles instead of Ninja
  • build.ninja deleted

⚡ Quick fix

  1. cmake -S . -B build -G Ninja then ninja -C build
  2. Run from the build folder
  3. Re-run configure

Detailed fix by platform

Shell

  1. cmake -G Ninja -S . -B build && ninja -C build

How to diagnose

  1. File — build.ninja exists?
  2. Generator — Ninja used?
  3. Dir — Right folder?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

C compiler cannot create executables — configure: error: C compiler cannot create executables / no acceptable C compiler found in $PATH (C/C++)C compiler cannot cre…Could not find a package configuration file — CMake Error: Could not find a package configuration file provided by "Foo" (requested version 1.2) (C/C++)Could not find a pack…does not appear to contain CMakeLists.txt — CMake Error: The source directory does not appear to contain CMakeLists.txt (C/C++)does not appear to co…Error 1 — make: *** [Makefile:12: target] Error 1 — a recipe command failed (C/C++)Error 1Killed signal terminated program cc1plus — g++: fatal error: Killed signal terminated program cc1plus — compilation terminated (out of memory) (C/C++)Killed signal termina…no such target — Bazel: ERROR: no such target '//pkg:name': target 'name' not declared in package 'pkg' (C/C++)no such targetNo targets specified and no makefile found — make: *** No targets specified and no makefile found. Stop. (C/C++)No targets specified …Unsupported gpu architecture — nvcc fatal: Unsupported gpu architecture 'compute_90' (C/C++)Unsupported gpu archi…ninja: er…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.