SPIRou is the newest spectropolarimeter and high-precision velocimeter that has recently been installed at the Canada-France-Hawaii Telescope on Maunakea, Hawaii. It operates in the near-infrared and simultaneously covers the 0.98-2.35 {mu}m domain at high spectral resolution. SPIRou is optimized for exoplanet search and characterization with the radial-velocity technique, and for polarization measurements in stellar lines and subsequent magnetic field studies. The host of the transiting hot Jupiter HD 189733 b has been observed during early science runs. We present the first near-infrared spectropolarimetric observations of the planet-hosting star as well as the stellar radial velocities as measured by SPIRou throughout the planetary orbit and two transit sequences. The planetary orbit and Rossiter-McLaughlin anomaly are both investigated and modeled. The orbital parameters and obliquity are all compatible with the values found in the optical. The obtained radial-velocity precision is compatible with about twice the photon-noise estimates for a K2 star under these conditions. The additional scatter around the orbit, of about 8 m/s, agrees with previous results that showed that the activity-induced scatter is the dominant factor. We analyzed the polarimetric signal, Zeeman broadening, and chromospheric activity tracers such as the 1083nm HeI and the 1282nm Pab{eta} lines to investigate stellar activity. First estimates of the average unsigned magnetic flux from the Zeeman broadening of the FeI lines give a magnetic flux of 290+-58 G, and the large-scale longitudinal field shows typical values of a few Gauss. These observations illustrate the potential of SPIRou for exoplanet characterization and magnetic and stellar activity studies.