I encountered the same issue. I made the following changes to the code.
- Commented out this line:
//x if (SPIFFS.begin(false) || SPIFFS.begin(true))
- Replaced the commented out line with this line:
SPIFFS.begin();
- Then commented out the "else" portion of the code in that block:
//x else
//x {
//x // Error mounting file system
//x Serial.println("Failed to mount FS");
//x }
So basically you eliminate the true/false test and always execute the code, not really sure why you would not want execute the code anyway.
Note: I also used the LittleFS, to make it simple toso I used the following include and define:
#include "LittleFS"
#define SPIFFS LittleFS
One final thing, I ran this on an ESP8266 mini D1 clone so I also changed the
#include <WiFi.h> to
To
#include <ESP8266WiFi.h>