Can I install NM cable, junction boxes on attic rafters
The j boxes need to be accessible if you can get in the attic even with a ladder they are accessible. Nailed or screwed down to the rafters is fine I like to run rat boards when traveling perpendicularly to the rafters that way they are supported if stepped on. Running parallel I staple them to the side 1-1/4” down the side. The insulation won’t be a problem.  Note a rat board can be a strip of plywood nailed to the rafters or even 2x4’ rat boards provide a good surface to staple the wires and prevent damage if they are stepped on between rafters.