---
title: "CMake/Ninja build error caused by long file paths on Windows"
canonical_url: "https://www.nutrient.io/guides/react-native/troubleshooting/windows-path-length-cmake-error/"
md_url: "https://www.nutrient.io/guides/react-native/troubleshooting/windows-path-length-cmake-error.md"
last_updated: "2026-06-08T09:14:14.437Z"
description: "Learn why Ninja fails with a ‘No such file or directory’ error during Android builds on Windows and how to fix it."
---

# CMake/Ninja build error caused by long file paths on Windows

When building your React Native app for Android on Windows, you may encounter the following error:

```

Task :app:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: error: mkdir(nutrient_sdk_react_native_codegen_autolinked_build/CMakeFiles/react_codegen_nutrient_sdk_react_native_codegen.dir/react/renderer/components/nutrient_sdk_react_native_codegen): No such file or directory

```

## Why this happens

Windows has a default maximum file path length of 260 characters (known as `MAX_PATH`). During an Android build, CMake and Ninja generate deeply nested build directories with long auto-generated names. When your project is located several folders deep in your file system, the combined length of your project path and these generated directory names can exceed the 260-character limit. When that happens, Ninja is unable to create the required directories, and the build fails with a misleading “No such file or directory” error — even though the parent directories exist.

This isn’t caused by your Gradle version or your Nutrient SDK setup; it’s a Windows-specific file system limitation.

## Solution

There are two ways to resolve this.

### Option 1: Move your project closer to the drive root (recommended)

This is the quickest fix. Move your project to a short path near the root of your drive, for example:

```

C:\myapp\

```

This reduces the total path length of all generated build files and keeps you well within the 260-character limit.

### Option 2: Enable Win32 long path support on Windows

For a more permanent fix, you can lift the 260-character limit systemwide by enabling Win32 long path support via the Group Policy Editor:

1. Open the **Group Policy Editor** by pressing **Win-R**, typing `gpedit.msc`, and pressing **Enter**.

2. Navigate to **Local Computer Policy** > **Computer Configuration** > **Administrative Templates** > **System** > **Filesystem**.

3. Double-click **Enable Win32 long paths** and set it to **Enabled**.

4. Click **OK** and restart your machine.

After restarting, retry your build with `npx expo run:android` (or your equivalent build command).

**Note** — The Group Policy Editor (`gpedit.msc`) is available on Windows 10 Pro, Enterprise, and Education editions. It isn’t available on Windows 10 Home. If you’re on Windows Home, use Option 1 or enable long paths via the registry: Set `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled` to `1`.

---

## Related pages

- [How to find your iOS app bundle ID easily](/guides/react-native/troubleshooting/finding-the-bundle-id.md)
- [Guide to adding a Nutrient license key in React Native](/guides/react-native/troubleshooting/add-license-key.md)
- [Fixing Android back button crash with Nutrient](/guides/react-native/troubleshooting/handling-back-navigation-with-react-native-screens.md)
- [Android Gradle Plugin Requires Java 11](/guides/react-native/troubleshooting/android-gradle-plugin-requires-java-11.md)
- [Troubleshooting](/guides/react-native/troubleshooting.md)
- [NutrientView inside a modal is blank or crashes on Android](/guides/react-native/troubleshooting/nutrientview-modal-android.md)
- [Out Of Memory Error React Native Android](/guides/react-native/troubleshooting/out-of-memory-error-react-native-android.md)
- [Find out your Nutrient version easily](/guides/react-native/troubleshooting/getting-the-currently-used-version.md)
- [Fix new architecture build issues in React Native](/guides/react-native/troubleshooting/new-architecture-build-issues.md)
- [Nightlies](/guides/react-native/troubleshooting/nightlies.md)
- [React Navigation](/guides/react-native/troubleshooting/react-navigation.md)
- [Managing Nutrient's render cache effectively](/guides/react-native/troubleshooting/outdated-render-cache.md)
- [Textinput Error React Native Android](/guides/react-native/troubleshooting/textinput-error-react-native-android.md)
- [Understanding bundle IDs for iOS app development](/guides/react-native/troubleshooting/what-is-a-bundle-id.md)
- [View controller-based status bar appearance](/guides/react-native/troubleshooting/view-controller-based-status-bar-appearance.md)
- [Understanding app IDs in Android development](/guides/react-native/troubleshooting/what-is-an-app-id.md)
- [Fix Xcode error code 65 for React Native on M1 Macs](/guides/react-native/troubleshooting/xcode-error-65-missing-required-target-architectures-react-native.md)

