It's very common by doing things too fast that we end up creating weird problems that no one else has. The problem today is the case of a Symfony recipe that wasn't installed on the project through composer because I didn't read the question and skipped everything and answering no. When I launched the project, there were some things missing in the package that I installed. After some research, I discovered that the problem was because of a simple property that was automatically created when installing the recipe of the package (at least that's what I thought). To solve the problem, I just needed to reinstall the recipe and that's it, however, how to do this isn't so clear in the documentation.
In this short article, I'm going to explain to you 2 ways to reinstall the recipe of a package installed through composer.
A. Force recipes synchronization
Simply run the following command to force the reinstallation of the recipes of the packages:
composer sync-recipes --force
If this solution doesn't work for you, proceed with the other one.
B. Reinstall package
If re-synchronization doesn't work for you, proceed with the reinstallation of the package. Remove your package as first:
composer rem package-name
Then, reinstall the package:
composer req package-name
You will note now, that the installation of the package didn't trigger the installation of the recipe. That's why you need to remove the corresponding package reference in the
symfony.lock file (it's like a JSON file, remove the key with the name of the package that you installed). After removing the reference, synchronize the recipes with the following command:
Happy coding ❤️!