Error when using "pmset sleepnow"
I struggled with the problem for months without any luck; the computer was unable to sleep, the sleep option on the apple menu was greyed out, pmset -g assertions (the most popular suggested solution to find ongoing processes) didn't return any result, and resetting the SMC didn't work. Today I finally found the solution that worked for mine

sudo pmset -a disablesleep 0


Hope this works for others too!