The search for the stable polymeric forms of solid nitrogen is of great importance in view of its poten-tial application as a high-energy-density material. Using first principles calculations combined with an effective crystal structure search method, we demonstrate that nitrogen can react with methane under rel-atively moderate pressures. The structures and the stability strongly depend on the composition. CN2H4 and CN4H4 compounds become stable in Pca21 and I-42d phases under pressures of 11 and 41 GPa, re-spectively. Especially, CN4H4 is recoverable as a metastable high energy material at ambient condition, and can release enormous amount of energy (6.43 kJg-1) while decomposing to molecular nitrogen and methane.