When you have a module with a same name at packagist.org and at magento marketplace, and the first is newer than the second, this error will happen. This is caused by magento/composer-dependency-version-audit-plugin module, as explained in the official docs.
This may happen when you don't upload the newest version to the marketplace or they are taking too long to approve your submission.
I found at least 3 ways to workaround the issue, but another user here gave a 4th and better option (see solution #4):
Solution 1: install the latest version from Adobe's Marketplace
Just add --no-plugins
to your composer require
command.
For example: composer require ricardomartins/pagseguro --no-plugins
.
This will ignore the above module execution and it will not check against packagist for newer versions. This way the above message will not be displayed.
Solution 2: Manually install the latest version
It's not really a solution, but if you really need the latest version from Packagist or Git, you may want to move the module to the app/code
folder and remove it from composer dependencies (composer remove package/module
).
Solution 3: Tell composer Magento is not a canonical repo
This way, if a newer version is available at packagist, it will be installed.
To do this, open composer.json
file and add "canonical": false
to Magento's repository, like follows:
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/",
"canonical": false
}
]
Solution 4 🏆: To exclude offending package from the repository.
You can also exclude the package-vendor/module-name
from the repo.magento.com repository
"repositories": {
"0": {
"type": "composer",
"url": "https://repo.magento.com/",
"exclude": ["package-vendor/module-name"]
}
}
Thus, running composer require package-vendor/module-name
will always pick up the latest Packagist release.
(answer provided by @Julien Loizelet)
Further reading (in Portuguese): I wrote a help article about this for the users of my PagSeguro module for Magento facing the same issue.