Assuming you're using Photon 2 and it's plugged in via USB, try holding down the mode button. While holding the mode button tap the reset button and continue holding mode until the LED flashed yellow. Then try to flash it.
I think you suggested to manually put the device into DFU mode, which I did. same error 'Device not found: p2'. Interestingly I could successfully flash the device using Web IDE, which is not my desired place for programming. any other suggestion to resolve this issue would highly be appreciated!
I found what the issue was for the respective error. I did not set the target device ID. The error disappeared once I assigned the device ID; thanks for your hint.
Interestingly without assigning the device ID, flashing the device, even with 'Device not found: p2 ' could successfully be done as my code was working. seems like assigning the 'Device ID' is optional and that was more warning than error!