[英]laravel 5.8.* installation failed
When I run a clean install laravel 5.8 get an error 当我运行一个干净的安装laravel 5.8得到一个错误
Laravel version 5.7 is installed without problems. Laravel 5.7版安装没有问题。 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 更新了我的.env文件此文件是在安装期间创建的
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}"
I do not see APP_KEY in your .env
file. 我的.env
文件中没有看到APP_KEY 。
At the command line, issue the following Artisan command to generate a key: 在命令行中,发出以下Artisan命令以生成密钥:
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
这将生成APP_KEY
的随机密钥,完成.env
编辑后,请在终端中输入此命令以进行清除缓存: php artisan config:cache
If you faced a problem because the vendor folder then follows these steps: 如果您遇到问题,因为供应商文件夹然后遵循以下步骤:
composer update --no-scripts
composer update
composer.json
--no-scripts :跳过composer.json
定义的脚本的执行 composer.json
file, it will replace the previous version installed. 如果找到更新的版本并且它与composer.json
文件中定义的版本约束兼容,它将替换以前安装的版本。 The composer.lock
file will be updated to reflect these changes. composer.lock
文件将更新以反映这些更改。 These two commands, we will Recreate the vendor folder in our project 这两个命令,我们将在我们的项目中重新创建vendor文件夹
You need to reinstall laravel
. 你需要重新安装laravel
。 Please delete your vendor
directory or rename it and then run composer install
. 请删除您的vendor
目录或重命名,然后运行composer install
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.