There should be 3 bearings. Two inside the wheel, and one in the pulley.
I personally measure how long the spacer needs to be by installing the pulley without the bearing and measuring to the wheel bearings. Err on the “slightly shorter” side, otherwise it will clunk around while you’re riding.