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

Home / Errors
Arduino build error

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

WiFi.h is the WiFi library of boards that have a radio: the ESP32 family, the Pico W and the Uno R4 WiFi.

Try the fixed sketch in Mokxi See the causes

- Build error
- 2 common causes

The message

## What the Arduino IDE prints

Output window

An Uno, a Nano or a Mega has no WiFi chip and no such library, so a sketch that includes it cannot build for them.

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

Causes

## The 2 usual causes with the fix

### 1The board has no WiFi

Choose a board with WiFi, such as an ESP32. In Mokxi the board joins a network written in software, so WiFi.begin() works with no radio.

Broken

Fixed

Mokxi’s build tab says: WiFi.h needs a board with Wi-Fi, and the Arduino Uno has none

Try this fix in Mokxi

### 2The ESP32 board package is not installed

With an ESP32 chosen but the package missing, the IDE falls back or stops. WiFi.h comes with the package.

- In the Arduino IDE, open Tools, Board, Boards Manager, search for esp32 and install the one by Espressif Systems.
- Pick the ESP32 board you have under Tools, Board, and compile again.
- On an ESP8266, include ESP8266WiFi.h instead of WiFi.h.

FAQ

## Questions and answers

### Which boards have WiFi.h?

ESP32 boards, the Raspberry Pi Pico W, and the Arduino Uno R4 WiFi. The ESP8266 uses ESP8266WiFi.h.

### Can I add WiFi to an Uno?

Yes, with a WiFi module such as an ESP-01 over serial. It is a different library with its own commands.

### Does WiFi work in Mokxi?

Yes, on a network written in software, with the name and password set on the board. There is no radio.

Next

## More errors and the longer guide

- fatal error: esp_camera.h: No such file or directory
- fatal error: espnow.h: No such file or directory

The longer guide to this error All Arduino errors
