if you’re logged in through SSH then you can’t run the “startx” command. At least that’s what I have experienced. You’ll need to hook up your RPi to a monitor and attach keyboard/mouse. Once you do that you should be able to run startx. I would also suggest to configure Patchbox to start the desktop environment automatically. Then you can use RDP or VNC to access the GUI remotely.
It does work on my Pi to have default boot target as console login screen, running startx when ssh’ed just works. But in case it doesn’t, setting the boot target to one of the Desktop options should help avoid having to use startx in the first place.