.pio\libdeps\esp32doit-devkit-v1\ESP Async WebServer\src/ESPAsyncWebServer.h:32:18: fatal error: WiFi.h: No such file or directory

I’m not an experienced user… but 3 months ago… last time I compiled my project it compiled and worked.
Today… I tried a compile and I got this error.
.pio\libdeps\esp32doit-devkit-v1\ESP Async WebServer\src/ESPAsyncWebServer.h:32:18: fatal error: WiFi.h: No such file or directory

I then did a pio upgrade in case but that didn’t fix it.

I have no idea why this has happened. I’ve not touched Platform io in 3 months nor changed the project but now I’m wondering what has happened?

Please show the full platformio.ini and the code you’re using.

Usually a library not recognizing a dependent library is an issue of not including the library header (aka doing #include <ESPAsyncWebServer.h> in the main cpp file) or having to use a different lib_ldf_mode setting.

;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_deps = 
	bodmer/TFT_eSPI@^2.3.59
	contrem/arduino-timer@^2.2.0
	iotappstory/IOTAppStory-ESP @ ^2.1.0-RC4
monitor_speed = 115200

The thing is, the last time I compiled this it simply compiled and worked. Today it doesn’t.

  Asynchronous WebServer library for Espressif MCUs

  Copyright (c) 2016 Hristo Gochkov. All rights reserved.
  This file is part of the esp8266 core for Arduino environment.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#ifndef _ESPAsyncWebServer_H_
#define _ESPAsyncWebServer_H_

#include "Arduino.h"

#include <functional>
#include "FS.h"

#include "StringArray.h"

#ifdef ESP32
#include <WiFi.h>
#include <AsyncTCP.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#else
#error Platform not supported
#endif

#define DEBUGF(...) //Serial.printf(__VA_ARGS__)


...
...

That’s the ESPASyncWebServer.h code, I meant your main sketch code (probably src/main.cpp)

#include <Arduino.h>
#include <Wire.h>
#include <i2cEncoderMiniLib.h>
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include <SPI.h>
#include <EEPROM.h>
#include "enums.h"
#include "driver/ledc.h"
#include "esp_err.h"
#include <encoders.h>
#include <buttons.h>
#include <display.h>
#include <ioboard.h>
#include <storageEEprom.h>
#include <storageglobal.h>
#include <ledccontroller.h>
#include <arduino-timer.h>
#include "ramps.h"
#include "AD9833.h"



#define EEPROM_SIZE 100



byte ledouts;
//byte potvalueA;

const int mySDA = 21; //
const int mySCL = 22; //

// I2C Interrupt
const int IntPin = 27; /* Definition of the interrupt pin. You can change according to your board */




TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h


//Class initialization with the I2C addresses
i2cEncoderMiniLib Encoder2(0x20); /* A0 is soldered */
i2cEncoderMiniLib Encoder1(0x21); /* A0 is soldered */
i2cEncoderMiniLib Encoder0(0x22); /* A0 is soldered */

void setup_ledc_controller(void);
bool displayRefresh(void *);
bool ms10Callback(void *);
bool ms30Callback(void *);
bool fadechange(void *);

void getstoredvalues(void);

void hspiCommand(void); // jUST A TEST FUNCTION


led_output_mode_t ledoutputmode; // auto or manual

// Create the timer instance
//Ticker timer1(buttontimerCallback,0,4000,MILLIS);
//Ticker timer2(printtest,0,4000,MILLIS);

auto timer0 = timer_create_default(); // create a timer with default settings
auto timer1 = timer_create_default(); // create a timer with default settings
auto timer2 = timer_create_default(); // create a timer with default settings
auto timer3 = timer_create_default(); // create a timer with default settings
auto timer4 = timer_create_default(); // create a timer with default settings


//Ticker ramp;
Timer<1, millis, const char *> ramp_timer;



//uninitalised pointers to SPI objects
//SPIClass * vspi = NULL;
SPIClass * hspi = NULL;

// dEFINIE aLT PINS FOR hspi

  #define HSPI_MISO   12
  #define HSPI_MOSI   13 
  #define HSPI_SCLK   32
  #define HSPI_SS     33

void setup() {
  
  Serial.begin(115200);
   delay(500);   
  Serial.println(" START");
  Serial.print("Chip ID: ");
  //Serial.println(ESP.getFlashChipId());

...
...

Have you tried both of these suggestions?

As yet I’ve not tried to change any code to ‘solve it’ simply because the last time I pressed compile, it worked perfectly.
I’ve come back to the project after 3 months, and to my knowledge I’ve changed nothing during that time.

I was wondering if an update to PIO happened automatically while I wasn’t watching … but I’ve forced an update today to see if that somehow resolved the problem, which it didn’t.
I can’t offer any other input as to why today it just fails with that error.