People aren t always careful about placing electrical boxes especially when installing fixtures with wide bases.
Light fixtures that do not require junction box.
What i d do in this admittedly awkward scenario is use a surface mounted pancake box screwed to the stud through the drywall and feed the cable into that through a cableclamp and back of box ko then mount the fixture to the pancake box.
Light fixture wiring if the new light fixture has the wire leads hanging out of the housing and there is no provision for internally containing and.
Scott if the new exterior light fixture has a built in junction box or an enclosure where the wiring connections can be made and protected then you would not need to install a junction box.
Surface mounted boxes are your friend here.
How to center a light fixture when the junction box is off center.
Metal boxes are usually made of aluminum steel or cast iron.
For example if you have a light fixture that doesn t need a box for mounting but the wiring connections are not protected by some kind of cover then you can t use the fixture without a junction box.
Many local building codes require metal junction boxes because they are durable and ensure long lasting performance.
Or if a fixture meets all of the criteria of a box but lacks a cable clamp don t use it without a box.
Whenever wires are spliced together in a circuit whether it s to hook up a switch or light fixture or simply to extend the length of a wire the splice connections must be inside a covered junction box.
The electrical box or junction box is a code requirement that was established to prevent fires and other electrical accidents.