Error out if an installation results in invalid peer dependencies.

Fixes #3079.