Can't install/require the ongr/elasticsearch-bundle "~5.0" as per github example.
Im running a fresh install of the latest symfony.
I'm running the following command: composer require ongr/elasticsearch-bundle "~5.0"
as per https://github.com/ongr-io/ElasticsearchBundle
composer require ongr/elasticsearch-bundle "~5.0"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.2.*"
Package operations: 7 installs, 0 updates, 0 removals
- Installing react/promise (v2.7.1): Loading from cache
- Installing guzzlehttp/streams (3.0.0): Loading from cache
- Installing guzzlehttp/ringphp (1.1.1): Loading from cache
- Installing elasticsearch/elasticsearch (v5.5.0): Loading from cache
- Installing ongr/elasticsearch-dsl (v5.0.6): Loading from cache
- Installing symfony/templating (v4.2.11): Loading from cache
- Installing ongr/elasticsearch-bundle (v5.2.4): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (c91982d16a3859d0a43fd4ff85aa437a)
- Configuring ongr/elasticsearch-bundle (>=v5.2.4): From auto-generated recipe
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 228:
!!
!! The child node "managers" at path "ongr_elasticsearch" must be configured.
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json to its original content.
What can I do to solve this issue?
The tutorial mentions a config.yml (which i dont have), i'd assume this would be created if it doesnt exist during the installation
The problem is that there's a script that clears Symfony cache immediately after the new dependencies are installed, before you get the chance to add proper configuration to your config files.
Assuming there's a section in your composer.json
file that looks like this:
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
you should remove the "cache:clear": "symfony-cmd"
line. If it doesn't look exactly like this, just remove all lines that contain cache:clear
. You might want to restore this line/these lines after you've successfully installed and configured ongr/elasticsearch-bundle
, so that you don't have to remember to clear cache manually after installing bundles that are better compatible with Symfony Flex, or don't fall victim to its overzealousness with trying to be helpful.
Alternatively, and this is probably a much better solution - get rid of symfony/flex
entirely. It has a nasty habit of messing up your configuration files when some 3rd party adds a command to a recipe without checking if all the requirements have been met. I know, I've been there.