Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation error #109

Closed
ManouLabs opened this issue Dec 14, 2020 · 7 comments
Closed

Installation error #109

ManouLabs opened this issue Dec 14, 2020 · 7 comments
Labels

Comments

@ManouLabs
Copy link

ManouLabs commented Dec 14, 2020

I got this while installing

Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking cviebrock/laravel-elasticsearch (8.0.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing cviebrock/laravel-elasticsearch (8.0.2): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   TypeError

  Return value of Cviebrock\LaravelElasticsearch\Manager::getDefaultConnection() must be of the type string, null returned

  at C:\xampp\htdocs\celeste\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.

  1   C:\xampp\htdocs\celeste\vendor\cviebrock\laravel-elasticsearch\src\Manager.php:56
      Cviebrock\LaravelElasticsearch\Manager::getDefaultConnection()

  2   C:\xampp\htdocs\celeste\vendor\cviebrock\laravel-elasticsearch\src\ServiceProvider.php:54
      Cviebrock\LaravelElasticsearch\Manager::connection()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
@Monica-Ibtikar
Copy link

I have the same problem

@cviebrock
Copy link
Contributor

Did you publish the configuration file?

@Monica-Ibtikar
Copy link

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

@cviebrock
Copy link
Contributor

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).

@internetbug256
Copy link

internetbug256 commented Mar 12, 2021

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?

@Mushood
Copy link
Contributor

Mushood commented May 9, 2021

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

@cviebrock
Copy link
Contributor

Closing old tickets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants