laravel 5.8。*安装失败

时间:2019-07-09 04:44:03

标签: php laravel laravel-5

运行全新安装的laravel 5.8时出现错误

Laravel 5.7版已安装成功。有人知道如何解决吗?

生成优化的自动加载文件

> 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

堆栈跟踪:

#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

更新我的 .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}"

2 个答案:

答案 0 :(得分:1)

在您的.env文件中没有看到 APP_KEY

在命令行中,发出以下Artisan命令以生成密钥:

php artisan key: generate

这将为APP_KEY生成一个随机密钥,完成.env编辑后,请在您的终端中输入以下命令以清除缓存:php artisan config:cache


如果由于供应商文件夹而遇到问题,请按照以下步骤操作:

composer update --no-scripts 
composer update
  • -无脚本:跳过composer.json中定义的脚本的执行
  • composer update :这将检查项目中所需的较新版本的库。如果找到较新的版本,并且与composer.json文件中定义的版本限制兼容,它将替换先前安装的版本。 composer.lock文件将被更新以反映这些更改。

这两个命令,我们将在项目中重新创建供应商文件夹

答案 1 :(得分:0)

您需要重新安装laravel。请删除您的vendor目录或重命名目录,然后运行composer install