I will assume it is the same issue I had a few weeks ago. I had an issue with CubeProgrammer 2.4 which was in my Program Files (x86)\ folder, while my CubeProgrammer 2.5 was in Program Files\. As of now, the makefile looks first for the CubeProgrammer version in the x86 fodler, then looks at another location if it cannot find any. This will be soon updated to reverse the search order to prevent this kind of issues.
- go to C:\Program Files (x86)\STMicroelectronics\STM32CubeProgrammer
- make sure it is the version 2.4 (open the /bin folder and open the STM32CubeProgrammer.exe or right click on it to look at its properties
- If it is the 2.4, uninstall it