composer dump-autoload error after fresh Laravel install - laravel

After a fresh install of Laravel 7, I snagged an error during the installation of google/cloud plugin.
My steps of what I did:
laravel new
composer require google/cloud
Then while installing, I encountered this error
Package manifest generated successfully.
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code -1073741819
Installation failed, reverting ./composer.json to its original content.
I've also noticed that the .env file is missing. I did update my global composer with composer selfupdate and same error still occurs.

Related

how to fix " PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found "?

when i run "php artisan jetstream:install livewire" I get this error :
PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in H:\xampp\htdocs\tadavom123\bootstrap\app.php:14
i try to fix it with this codes but not working :
composer update
php artisan clear-compiled
composer dump-autoload
composer update --no-scripts
my composer version is : 2
php version : 7.3.10
laravel version: 8
in my case, you have to make sure that you write that code in folder that you want to run. In other hand, you need have a library php5-curl installed in your system, do this:
sudo apt-get install php7.3-curl
this curl have to be same with your php version. good luck.

I can't install laravel/socialite package using composer

laravel-version: 7.24.0
os: windows
I run the following command in the command prompt.
composer require laravel/socialite
but it fails and the output is :
D:\...\xxx>composer require laravel/socialite
Using version ^4.4 for laravel/socialite
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing league/oauth1-client (1.7.0): Loading from cache
- Installing laravel/socialite (v4.4.1): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
In ProviderRepository.php line 208:
Class 'Laravel\Socialite\SocialiteServiceProvider' not found
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
I've tried dump-autoload, and clear configs but anything didn't help me.
The error occurs because socialite package wasn't really installed.
I've checked vender/laravel directory, and socialite wasn't installed.
composer tried to download socialite package but failed. But composer ignores the fail of socialite package, so after composer command completed, they can't find Class 'Laravel\Socialite\SocialiteServiceProvider'.
I'm not sure why downloading socialite package, but I think it's mostly network problem(slow speed or blocked ip location, etc).
So I solved by copying socialite package to vendor directory.

laravel scout full text search installation error

while installing the laravel/scout in my laravel 5 app, am getting error.
I have run the following command in putty
composer require laravel/scout
And I got the following error message:
php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Killed
Any idea why am getting this error message.

Laravel 5 Composer Require laravelcollective/html Error

When I was going to require laravelcollective/html, there is something wrong! I searched this error in Google but didn't find any answer. Any help?
Thanks a lot!
D:\wamp\www\laravel-5.1>composer require "laravelcollective/html:5.1.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing laravel/framework (v5.1.19)
- Installing laravel/framework (v5.1.19)
Loading from cache
- Installing laravelcollective/html (v5.1.6)
Loading from cache
Writing lock file
Generating autoload files
> php artisan clear-compiled
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Routing\RouteCollection::refreshNameLookups()
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:

Switching from Illuminate\Html to Collective\Html, Class 'Illuminate\Html\HtmlServiceProvider' not found

I updated composer.json to remove illuminate\html and add:
"require": {
"laravelcollective/html": "5.1.*"
I removed the providers/aliases from app.php for Illuminate\Html and added the replacements:
Collective\Html\HtmlServiceProvider::class,
...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
However when running composer update I receive the output:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing illuminate/html (v5.0.0)
- Installing laravelcollective/html (v5.1.4)
Downloading: 100%
Writing lock file
Generating autoload files
> php artisan clear-compiled
PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 648
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Html\HtmlServiceProvider' not found
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 648
I tried updating composer.json scripts as suggested here: https://github.com/LaravelCollective/html/issues/54
But I'm still receiving the error.
Any help is greatly appreciated :)
In the end I managed to fix this with some help on IRC (thanks sisve) and these commands. First I rolled back to a working site with illuminate/html. Then:
composer dumpautoload
composer clearcache
php artisan clear-compiled
If the clear-compiled fails then make sure there are no references to Illuminate\Html in bootstrap/cache/config.php and run it again.
Remove all references to Illuminate\Html in config/app.php
Remove the illuminate/html require in composer.json
composer update
Add the laravelcollective/html package as described here: http://laravelcollective.com/docs/5.1/html#installation
composer update

Resources