存储文件夹问题 - 获取无效参数异常



在过去的几个小时里,我一直在尝试加载我的主视图。我在存储/框架目录中创建了以下文件夹

views
sessions
cache

我在 iTerm 中运行了以下命令

php artisan config:clear
php artisan cache:clear
composer dump-autoload
composer install

此外,我更新了宅基地和 laravel 框架,但我仍然遇到同样的错误。这不起作用有什么原因吗?

这是错误

(1/1( 无效参数异常 请提供有效的缓存路径。

编辑2:这是我的配置/应用程序.php文件


return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT  => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];

和我的 .env

APP_ENV=local
APP_KEY=base64:zVCAwUs7ONVbb/gWHhzDEkbBfmcNvqkCIU0tvcaGUQ4=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://bitpaigow.localhost:8000
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=paigow
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
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
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

例外:

无效参数异常 请提供有效的缓存路径。

不是在 LaravelCache中提出的,但它可以在IlluminateViewCompilersCompiler类中找到,确切地说是该类的构造函数:

public function __construct(Filesystem $files, $cachePath)
{
if (! $cachePath) {
throw new InvalidArgumentException('Please provide a valid cache path.');
}
...

因此,错误是由找不到已编译视图缓存路径的View Compiler类引发的。鉴于您发布的代码,我的建议是:

  1. config/cache.php中恢复原始stores.file.path配置:
'path' => storage_path('framework/cache/data'),
  1. 检查您的服务器在storage/framework/views目录中是否具有正确的权限输入、读取和写入
  2. 查看您的config/view.php文件,它应该是这样的:
<?php
return [
/*
*/
'paths' => [
resource_path('views'),
],
/*
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
  1. 检查您的.env文件,您是否尚未将VIEW_COMPILED_PATH条目设置为某个奇怪的路径。
  2. php artisan config:clear
  3. 最后但最不重要的:restart the HTTP server.

最新更新