192. – Then (v. 17) he explains what he had said about the punishment.
193. – He says, therefore: With whom was he provoked forty years? Was it not with them that sinned? From this it is clear that forty years refers to the statement, I was provoked. Hence, he says that he was offended through those forty years. Here it should be noted that all who left Egypt died in the desert, as it is stated in Jos. (5:4), but not all were laid low, but only some: either by God, as when the earth opened and swallowed Dathan and Abiram (Ps. 77); but others were laid low by Moses, as in the construction of t...he golden calf (Ex. 32); still others were killed by enemies, and some died a natural death. Therefore, not all were laid low. Hence, it was not a general punishment, although it was general enough so that only two should enter the promised land.
Source: Commentary on Hebrews