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

**Code:** `ninja: error` · **Category:** C/C++ · **Seen on:** Ninja, CMake

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/ninja-build-dyndep-or-stale)
