how to caculate moles with only molarmass

You need grams, too, unless you want to know the molar mass of one (1) mole. In that case, it's just the relative molar mass of the material. For example, the molar mass of NaCl is about 58.5, so the mass of 1 mole = 58.5 grams NaCl.