Source: https://mokxi.com/errors/no-such-file-or-directory
Updated: 2026-11-16

Home / Errors
Arduino build error

# fatal error: Servo.h: No such file or directory

The compiler looked for the file named in an #include line and it is not there.

Try the fixed sketch in Mokxi See the causes

- Build error
- 3 common causes
- Seen 673 times in failed builds on Mokxi in the 30 days to November 16, 2026.

The message

## What the Arduino IDE prints

Output window

Either the name does not match the real header exactly, the library is not installed, or the file is your own and is not in the sketch.

Mokxi's compiler, clang, words it as 'Servo.h' file not found.

Causes

## The 3 usual causes with the fix

### 1The header name is not the library’s header name

A letter too many, a missing underscore or the wrong capitals all give this error. Windows and most Macs ignore capitals in file names and Linux does not, so a sketch can build on one machine and fail on another. Copy the name from the library, or from its example.

Broken

Fixed

Mokxi’s build tab says: Mokxi has no Servos.h, and ships Servo.h, one or two letters away: if that is the library you mean, write #include <Servo.h>.

Try this fix in Mokxi

### 2The library is not installed

A library that does not ship with the Arduino IDE has to be installed once before its header exists. Your sketch can be perfect and still fail until then. Mokxi already has the common ones, so a sketch like this builds there as it is.

- In the Arduino IDE, open Sketch, Include Library, Manage Libraries.
- Search for the library by the name its example uses, here Adafruit NeoPixel, and press Install.
- Accept the other libraries it asks for, then compile again.

Works once the library is installed

Try this fix in Mokxi

### 3A header of your own that is not in the sketch

A line like #include "pins.h" with quotes means a file in your sketch folder. If no tab named pins.h exists, the compiler cannot open it. Add the tab, or put the constants in the sketch itself.

Broken

Fixed

Mokxi’s build tab says: This project has no file named pins.h.

Try this fix in Mokxi

FAQ

## Questions and answers

### What does 'No such file or directory' mean in an Arduino build?

An #include names a header file the compiler cannot find. The name is spelled differently from the real file, the library is not installed, or your own file is missing from the sketch.

### Why does the same sketch build on Windows and fail on Linux?

Windows and most Macs ignore capital letters in file names, and Linux does not. #include <servo.h> finds Servo.h on the first two and fails on Linux.

### Do I need to install libraries in Mokxi?

Not the common ones. Servo, Wire, LiquidCrystal_I2C, Adafruit_NeoPixel, DHT and many more are built in. A header Mokxi does not ship is named in the build tab with the closest one it does.

Next

## More errors and the longer guide

- error: 'Servo' does not name a type
- error: 'ledPin' was not declared in this scope

The longer guide to this error All Arduino errors
