Then I found a Apple support link to solve this issue via a terminal command.
Open your terminal on your mac and then type the command below.
sudo pmset -a disablesleep 1 That’s it. Now you can prevent your mac from the sleep mode. The support link isn’t updated by Apple anymore. So I guess that in the future Apple might force the command doesn’t work.