I tried using
/gamemode doMobSpawning false, but it said it was invalid. What do I do?
To remove all mobs (other than player-placed ones, such as armor stands), simply use the mob spawning gamerule.
I don't know why Minecraft seems to be spitting out errors, but what you've typed seems to be correct. Are you perhaps using a version of Minecraft prior to 1.4.2?
/gamerule doMobSpawning false
If you do not want to have to worry about hunger, simply have a command block on loop running this command:
/effect @a minecraft:saturation 2 10
Alternatively, peaceful difficulty does the above, only that it still allows peaceful (animals) to spawn.