When installing Advanced Custom Fields (ACF) Pro via composer I was getting the following error:

“The requested package advanced-custom-fields/advanced-custom-fields-pro could not be found in any version, there may be a typo in the package name.”

To resolve this I had to add a custom repository to my composer.json file in the repositories section:

{
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "5.6.0",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
"url": "https://connect.advancedcustomfields.com/index.php?p=pro&a=download"
},
"require": {
"philippbaschke/acf-pro-installer": "^1.0",
"composer/installers": "^1.0"
}
}
}

This then tells composer apart from the standard repository packagist you can also use this custom repository to find packages. You also include what package version your new repository contains; in this example, version 5.6.0.

Since our package repository can only contain one package with a specific version, we are forced to update the version in the package repository whenever we want to update.

Leave a Reply

Your email address will not be published. Required fields are marked *