Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel 5.8.* installation failed

When I run a clean install laravel 5.8 get an error

Laravel version 5.7 is installed without problems. Does anyone know how to fix it?

Generating optimized autoload files

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Fatal error:  Uncaught ReflectionException: Class config does not exist in /home/projects/test/vendor/laravel/framework/src/Illuminate/Container/Container.php:790

Stack trace:

#0 /home/projects/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(790): ReflectionClass->__construct('config')
#1 /home/projects/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\Container\Container->build('config')
#2 /home/projects/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(615): Illuminate\Container\Container->resolve('config', Array)
#3 /home/projects/test/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(767): Illuminate\Container\Container->make('config', Array)
#4 /home/projects/test/vendor/laravel/framework/src/Illuminate/Container/Container.php(1225): Illuminate\Foundation\Application->make('config')
#5 /home/projects/test/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(417): Illuminate\Container\Container->offsetGet('config')
#6 /h in /home/projects/test/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 790

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

Updated my .env file This file is created during installation

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
like image 601
Anton Pirojkov Avatar asked Jul 09 '19 04:07

Anton Pirojkov


1 Answers

I do not see APP_KEY in your .env file.

At the command line, issue the following Artisan command to generate a key:

php artisan key: generate

This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache


If you faced a problem because the vendor folder then follows these steps:

composer update --no-scripts 
composer update
  • --no-scripts: Skips execution of scripts defined in composer.json
  • composer update: This will check for newer versions of the libraries you required in your project. If a newer version is found and it's compatible with the version constraint defined in the composer.json file, it will replace the previous version installed. The composer.lock file will be updated to reflect these changes.

These two commands, we will Recreate the vendor folder in our project

like image 92
Udhav Sarvaiya Avatar answered Oct 23 '22 14:10

Udhav Sarvaiya