WiFi.h or ESP8266WiFi.h not found (wrong board chosen)
- ESP32
- ESP8266
You may see
Why it happens
- The board menu is on Arduino Uno, or on the other ESP board.
- ESP32 code uses
WiFi.h; ESP8266 code usesESP8266WiFi.h. - Libraries with the same name were downloaded by hand for a different board.
How to fix it
- Choose your real board in Tools > Board (ESP32 Dev Module, or NodeMCU 1.0 for the ESP8266).
- If the board isn't listed, install it first with the Boards Manager.
- Don't install a library called ESP8266WiFi or WiFi from the internet: they come with the board package.
- Delete such a copy from Documents/Arduino/libraries if you have one.
It worked if: Verify passes with your board named at the bottom right of the IDE.
Related errors
Tutorials where it can happen
- Building a Motion Detection System Using ESP32 and ESP-NOW
- ESP32 / ESP8266 - Realtime Database with Firebase
- ESP32 Async Web Server Code
- ESP32 BLE Server and Client with Arduino IDE
- ESP32 DHT11 Web Server: Show Temperature and Humidity
- ESP32 Web Server: Control LED Brightness with a Slider
11 more
- ESP32/ESP8266 Data Logging to Firebase with Login
- ESP8266 NodeMCU Relay: Control AC Appliances
- How to make an ESP32 Web Server?
- How to make an ESP8266 Web Server?
- How to use Bluetooth on the ESP32 ?
- How to use the BLE on the ESP32?
- Log DHT11 Data to Firebase Realtime Database: the Code
- Put Your Web Page on a Real ESP32
- Send Emails with ESP8266 NodeMCU
- Smart Plant Pot with ESP32 (IoT)
- What is a Web Socket Server?
Seen in a real run (some lines are close variants of it). Produced with Arduino CLI 1.5.1 and Arduino AVR core 1.8.8 (the same compiler the Arduino IDE uses). Compiled for Arduino Uno on purpose.
Didn't help? Search another error or ask us.

