The case:
I want to install Laravel on my computer (info: Linux 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
)
When I ran composer create-project laravel/laravel exapp
everything works fine, but dependencies are not installed to serve a Laravel project (./artisan serve
).
I ran composer install
but the vendor
directory doesn't exist then I ran composer update && composer install
but vendor
director is not created.
Then I attempted to install dependencies by composer dump-autoload
it gives me following error:
Generating optimized autoload files
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
@php artisan package:discover --ansi
PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in /opt/lampp/htdocs/exapp/bootstrap/app.php:14
Stack trace:
#0 /opt/lampp/htdocs/exapp/artisan(20): require_once()
#1 {main}
thrown in /opt/lampp/htdocs/exapp/bootstrap/app.php on line 14
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
The vendor folder is created so I run php artisan serve
and ./artisan serve
the following error occurred;
PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in /opt/lampp/htdocs/exapp/bootstrap/app.php:14
Stack trace:
#0 /opt/lampp/htdocs/exapp/artisan(20): require_once()
#1 {main}
thrown in /opt/lampp/htdocs/exapp/bootstrap/app.php on line 14
My path for xampp is /opt/lampp
and I ran above commands in /opt/lampp/htdocs/exapp
as superuser/root and as ordinary user.