Résumé : This paper reports the measurement of J / ψ meson production in proton–proton (p p) and proton–lead (p Pb) collisions at a center-of-mass energy per nucleon pair of 5.02TeV by the CMS experiment at the LHC. The data samples used in the analysis correspond to integrated luminosities of 28pb-1 and 35nb-1 for p p and p Pb collisions, respectively. Prompt and nonprompt J / ψ mesons, the latter produced in the decay of B hadrons, are measured in their dimuon decay channels. Differential cross sections are measured in the transverse momentum range of 2<pT<30GeV/c, and center-of-mass rapidity ranges of