Remove affected food immediately and dispose of it outside. Check everything else in the cupboard. Food cans and bottles will be fine, but make sure there are no insects hiding under the labels. Treat area with a good household insecticide which is suitable for use near food. Clean out all the dust, crumbs etc. and make sure the cupboard is completely dry.
Find the cause of humidity and cure it.