"There was thunder and lightning all night."
Translation:Estis fulmotondro la tutan nokton.
Estis fulmotondro la tutan nokton = Estis fulmotondro dum la tuta nokto
Ending -n can be used to express time and then it replaces some prepositional phrase, here: "dum la tuta nokto".
Just to complete mihxal’s answer, in Esperanto the only words without preposition nor accusative is a part of the subject of your sentence ☺
If you want to add something to your sentence, but don’t know what to do with it, you should either put it in the accusative case (i.e. add -n), or add the preposition je before (or any other preposition which you find more accurate in your case!). For instance, Estis fulmotrondo je la tuta nokto is acceptable (although dum is better than je here).