Outlet screwed directly into stud
It looks like you are up against a corner on the left, which means you can't simply shift the outlet into the box location. In a perfect world you have enough cable to move the box to the other side of that stud. You would then simply repair your drywall. (We've since learned that there's a door to the right, just out of frame, making this impossible.)

Otherwise I would find a shallow box and cut the stud back so that the box can sit partially or completely in front of it. Since you are right near a corner you can safely take a third to a half of the stud out without concern. It may not strictly meet code, but experience tells me it won't be a problem.

A good way to do that is with a nice sharp spade bit of 1 inch or so. Just make a series of straight-in bores in a grid pattern to cut the wood away. Mark your depth on the side of the stud before hand so you know how deep to go.