The electrical box or junction box is a code requirement that was established to prevent fires and other electrical accidents.
Light fixtures that do not require junction box.
How to center a light fixture when the junction box is off center.
People aren t always careful about placing electrical boxes especially when installing fixtures with wide bases.
The boxes made without metal are pvc or plastic.
Many local building codes require metal junction boxes because they are durable and ensure long lasting performance.
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.
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.
Surface mounted boxes are your friend here.
It ll stick out slightly but it beats sparky splices lighting your studs up.
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.
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.
Choose from many junction box sizes to find the one that best suits your project.