Server not loading Laravel app after a composer install - composer-php

After a deploy which required an composer install, the app is no longer working at all, and I get this error in nginx error log:
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:335
I use Laravel 9 with php8.1.
I tried to delete the vendor and reinstall composer, clearing cache, optimize.
Thanks.

Related

Laravel 8 Error Illuminate\Support\ServiceProvider::loadRoutesFrom()

I installed jetstream and livewire. After installation I got this error
Illuminate\Support\ServiceProvider::loadRoutesFrom(): Failed opening required 'D:\xampp\htdocs\suo\webapp\vendor\laravel\jetstream\src/../routes/.php' (include_path='D:\xampp\php\PEAR')
I tried to clear cache using following command
php artisan config:cache
But it also shows many warnings and then this error
Symfony\Component\ErrorHandler\Error\FatalError
Couldn't find any working solution. Any idea?

Upgrade to Laravel 5.4 causing undefined method dispatch() on push to Forge

I recently updated Laravel app from 5.3 -> 5.4 and got it working fine on local computer.
I pushed the update to bitbucket which then deployed to my web server via Forge, but I keep getting the following error;
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Events\Dispatcher::dispatch() in /home/forge/appname/vendor/laravel/framework/src/Illuminate/Console/Application.php:56
I have tried deleting cache files from /bootstrap/cache and storage/framework/
and also running php artisan cache:clear and php artisan view:clear
I also tried uninstalling and re-installing the repo on Forge. It seems that it will do the initial install/deploy ok, but then if I push any updates, it fails with the same error.
Anyone got any other ideas?
Only way I found to resolve was to completely delete the site on Forge and then add it as a new one.

Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() error laravel 5.4

I am uploading a laravel 5.4 project to cpanel server.
And i am serve with
PHP Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos()
on server.
I have done
composer require symfony/polyfill-iconv
However, it does not change the error message.
What thing i might miss out?
Be sure that you have php-iconv and php-mbstring installed on the server. Then check again. By default, mbstring is not installed on cPanel/WHM servers

Composer failing on elastic beanstack deploying

I had run the same deploy hooks on AWS’s elastic beanstalk since I started deploying laravel to elastic beanstalk and on a recent update it failed to deploy due to something happening with the most recent composer.
The common approach to deploy with composer on elastic beanstalk is to update composer then use it to install your packages, which worked fine until I got the following error
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Warning: require(/var/app/ondeck/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/app/ondeck/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required ‘/var/app/ondeck/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /var/app/ondeck/bootstrap/autoload.php on line 17
As you can see, laravel couldn’t find the autoload file from the vendor folder which was a result of composer not running correctly
What would be the error and how to fix it.
I had the same issue this comes when you have made lot of changes in the development to the composer file and the environment which you set to deploy has no updates on the composer. First update you deployment machine by updating composer before deploying. This will solve your issue.

Laravel - Error while running php artisan - with MAMP PRO

First steps with Laravel 5 on MacOSX running MAMP PRO stack.
php artisan
I got the following error:
[RuntimeException]
Error Output: PHP Warning:
require(/Users/../../bootstrap/../vendor/autoload.php): failed to open
stream: No such file or directory in
/Users/../../bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required
'/Users/../../bootstrap/../vendor/autoload.php' (include_p
ath='.:/Applications/MAMP/bin/php/php5.6.10/lib/php') in
/Users/../../bootstrap/autoload.php on line 17
It seems to be related with some bootstrap autoload and MAMP php binaries... But this is as far as I can understand this.
Can I have some advices please?
If I run composer update instead, I do get the same Fatal Error.
It seems you have give a wrong path,re install the laravel.
Thank you for your answers.
I had some issues with composer assets plugin. I have:
1) Remove the folder related to the composer assets plugin.
2) Reinstalled.
3) go to the root diretory of my laravel project.
4) run sudo composer install
Runned php artisan and all seems to be working as expected.
Thank you so much for your time.

Resources