An earthquake has struck the Italian city of Naples, causing locals to spend the night on the streets and in their cars.