【发布时间】:2020-07-10 01:09:22
【问题描述】:
我有一个新创建的 Laravel 应用程序,其中安装了 Backpack。在过去的几天里,我一直在努力将其部署到 Google Cloud。
我正在使用 Laravel 7,我正在尝试部署到 Google 云 App Engine 并收到 Class hash does not exist 错误。有几次我也收到了Class view does not exist。
我很确定这与部署环境有关,而不是我的更改。之所以这么说,是因为今天早上我更新了backpack/crud版本,部署后应用运行成功了。
所以只是为了测试,我再次部署,没有做任何更改,上传了零个文件,我遇到了同样的问题!
如果有人能指点我可以尝试的方法,那就太好了。
2020/07/09 23:42:46 [error] 20#20: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ReflectionException: Class hash does not exist in /srv/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
Stack trace:
#0 /srv/vendor/laravel/framework/src/Illuminate/Container/Container.php(805): ReflectionClass->__construct('hash')
#1 /srv/vendor/laravel/framework/src/Illuminate/Container/Container.php(687): Illuminate\Container\Container->build('hash')
#2 /srv/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve('hash', Array, true)
#3 /srv/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Foundation\Application->resolve('hash', Array)
#4 /srv/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\Container\Container->make('hash', Array)
#5 /srv/vendor/laravel/framework/src/Illuminate/Container/Container.php(1280): Illuminate\Foundation\Application->make('hash')
#6 /srv/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserPro...PHP message: PHP Fatal error: Uncaught ReflectionException: Class hash does not exist in /srv/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
我的 composer.json -
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"backpack/crud": "4.1.*",
"backpack/permissionmanager": "^6.0",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.5",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"superbalist/laravel-google-cloud-storage": "^2.2"
},
"require-dev": {
"backpack/generators": "^3.1",
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"laracasts/generators": "^1.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"post-install-cmd": [
"composer clearcache",
"chmod -R 755 bootstrap\/cache",
"php artisan cache:clear",
"php artisan config:clear"
]
}
}
【问题讨论】:
-
似乎更多的是由于某种原因没有设置容器上的“哈希”绑定
-
在应用文件夹中搜索“use Hash;”我发现一个没有被使用的电话,我刚刚删除它,问题就消失了。
标签: laravel google-app-engine gcloud