When you install some new extension package in Magento 2 via the composer you can get an error:
Package vendor/module-name exists in composer repo (https://repo.packagist.org) and composer repo (https://repo.magento.com) which has a higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
This error message is self-explaining and contains a link to the composer documentation.
The problem is that a module you try to install has an old version in the Magento composer repository and a new version in the free public packagist.org repository. However, the Magento repository has a higher priority and that is why composer cannot install the latest version and throws this error.
What you need to do to solve the issue is to:
1. Open composer.json file in your Magento 2 root directory.
2. Find the "repositories" section.
3. Replace the following code
with this one
"exclude": ["vendor/module-name", "vendor/module-name2"]
Basically, you need to give the Magento repository not topmost priority.
4. Save the changes and try to install Magento 2 extension again.