The gas transport in nanopores of shale gas reservoirs is significantly different from that in conventional gas reservoirs. A model for ideal gas in nanopores is derived based on a weighted summation of slip flow and Knudsen diffusion, where ratios of intermolecular collisions and molecular and nanopores wall collisions to total collisions are the weighted factors of slip flow and Knudsen diffusion, respectively. This model is extended to the application of real gas transport in nanopores by taking into account the effects of intermolecular force and gas molecule volume on mass transport under the condition of high pressure. The model is validated by published molecular simulation data. The results show that the model is more reasonable to describe all of the gas transport mechanisms known, including continuous flow, slip flow and transition flow; the degree of real gas effects on gas transport is up to 23%, which is controlled by pressure, temperature, nanopores radius and gas type; and methane transport capacity is underestimated by 65.09% with helium and overestimated by 106.27% with nitrogen in simulation of methane transport in shale nanopores under the condition of laboratory experiments.