gpt4 book ai didi

laravel - 无法创建根目录 - swagger with laravel

转载 作者:行者123 更新时间:2023-12-02 19:46:34 24 4
gpt4 key购买 nike

我正在尝试在我的 Laravel Rest API 上添加 swagger 文档。首先,我安装了 composer require "darkaonline/l5-swagger" 然后 composer require zircote/swagger-php 然后我运行了

php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"

但出现以下错误。

   League\Flysystem\Exception  : Impossible to create the root directory "". 

at C:\xampp\htdocs\landing-temp\vendor\league\flysystem\src\Adapter\Local.php:112
108| clearstatcache(false, $root);
109|
110| if ( ! is_dir($root)) {
111| $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : '';
> 112| throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage));
113| }
114| }
115| }
116|

Exception trace:

1 League\Flysystem\Adapter\Local::ensureDirectory()
C:\xampp\htdocs\landing-temp\vendor\league\flysystem\src\Adapter\Local.php:78

2 League\Flysystem\Adapter\Local::__construct()
C:\xampp\htdocs\landing-temp\vendor\laravel\framework\src\Illuminate\Foundation\Console\VendorPublishCommand.php:235

Please use the argument -v to see more details.

我应该怎么做才能解决这个问题?

最佳答案

对于 Laravel 8。文档说它使用包自动发现功能。但这不是真的。

您必须添加到 config/app.php 的提供程序部分:

L5Swagger\L5SwaggerServiceProvider::class,

然后,您必须运行

php artisan config:cache

只有这样,您才能运行

php artisan vendor:publish --provider 'L5Swagger\L5SwaggerServiceProvider'

关于laravel - 无法创建根目录 - swagger with laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59133714/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com