Indeed, you can run a generator in a box but there needs to be some sort of ventilation. All the gases coming out of it needs to get displaced in the air.