Installing esptool.py
We'll use esptool, which is a “Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips,” to perform an ESP8266 factory reset.
You need Python 3.7 or newer installed on your system to install esptool. Make sure you choose the right package for your system before beginning the download and installation process at the following link:
Learn more about it on LEDEdit PRO
https://lededitpro.com/erase-esp8266-nodemcu-flash-memory