  We study for the first time the production of charmonia in nuclear
ultra-peripheral and electron-ion collisions based on a rigorous Green function
formalism. Such formalism allows to incorporate properly formation effects
(color transparency), as well as the quantum coherence inherent in higher twist
shadowing corrections related to the $|Q \bar{Q}\rangle$ Fock component of the
photon. The leading twist gluon shadowing associated with multi-gluon photon
fluctuations is also included within the same formalism. The later effect
represents the dominant source of shadowing at mid rapidities in the LHC
kinematic region, while the reduced effect of quark shadowing leads to a
significant modification of differential cross sections $d\sigma/dy$ at forward
and/or backwards rapidities. Model calculations for $d\sigma/dy$ are in a good
agreement with available UPC data on coherent charmonium production at RHIC and
the LHC. In addition, we also perform predictions for nuclear effects in the
electroproduction of charmonia, which can be verified by new data from
electron-ion colliders.
