Closed ManouLabs closed 2 years ago
I have the same problem
Did you publish the configuration file?
Did you publish the configuration file?
I got the error on installing the package by composer and because of the error the package won't be installed
Which version of Laravel are you using? I just tried a fresh project, and I didn't get the same error as you.
> composer create-project laravel/laravel laravel8
...
> cd laravel8
> composer require cviebrock/laravel-elasticsearch
Can you try the above and see what you get?
Maybe it's a XAMPP issue (I don't have a Windows machine handy for testing).
Hi there. It's happening to me too. I am using latest Laravel 8.x, on a Linux machine.
Error is exactly the same. I even tried to create the config/elasticsearch.php file BEFORE running composer, and got exactly the same error...
Do I have to install previously some other composer package related to Elasticsearch?
Same issue on windows homestead
vagrant@homestead ~/code/bcu/docker-bcu (master) $ sudo docker exec -it bcu-bcu composer require cviebrock/laravel-elasticsearch
Using version ^8.0 for cviebrock/laravel-elasticsearch
./composer.json has been updated
Running composer update cviebrock/laravel-elasticsearch
Loading composer repositories with package information
Updating dependencies
Lock file operations: 5 installs, 0 updates, 0 removals
- Locking cviebrock/laravel-elasticsearch (8.0.4)
- Locking elasticsearch/elasticsearch (v7.12.0)
- Locking ezimuel/guzzlestreams (3.0.1)
- Locking ezimuel/ringphp (1.1.2)
- Locking react/promise (v2.8.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
- Installing react/promise (v2.8.0): Extracting archive
- Installing ezimuel/guzzlestreams (3.0.1): Extracting archive
- Installing ezimuel/ringphp (1.1.2): Extracting archive
- Installing elasticsearch/elasticsearch (v7.12.0): Extracting archive
- Installing cviebrock/laravel-elasticsearch (8.0.4): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
TypeError
Cviebrock\LaravelElasticsearch\Manager::getDefaultConnection(): Return value must be of type string, null returned
at vendor/cviebrock/laravel-elasticsearch/src/Manager.php:74
70▕ * @return string
71▕ */
72▕ public function getDefaultConnection(): string
73▕ {
➜ 74▕ return $this->app['config']['elasticsearch.defaultConnection'];
75▕ }
76▕
77▕ /**
78▕ * Set the default connection.
+21 vendor frames
22 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
The way i fixed it is to create a config/elasticsearch.php AND deleting the files in bootstrap/cache
Closing old tickets.
I got this while installing