我使用Laravel导入上传至google云存储的文件已经有一段时间了。 在没有改变任何代码的情况下,下面的调用突然停止工作。
Excel::import($importer, $document->path, env('GOOGLE_STORAGE_DISK', 'local'), $fileType);
从导入方法中追踪到的返回错误如下。
"message": "mkdir(): No such file or directory",
"exception": "ErrorException",
"file": "/workspace/vendor/maatwebsite/excel/src/Files/TemporaryFileFactory.php",
"line": 52,
"trace": [
"function": "handleError",
"class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
"type": "->"
"file": "/workspace/vendor/maatwebsite/excel/src/Files/TemporaryFileFactory.php",
"line": 52,
"function": "mkdir"
"file": "/workspace/vendor/maatwebsite/excel/src/Reader.php",
"line": 398,
"function": "makeLocal",
"class": "Maatwebsite\\Excel\\Files\\TemporaryFileFactory",
"type": "->"
"file": "/workspace/vendor/maatwebsite/excel/src/Reader.php",
"line": 99,
"function": "getReader",
"class": "Maatwebsite\\Excel\\Reader",
"type": "->"
"file": "/workspace/vendor/maatwebsite/excel/src/Excel.php",
"line": 146,
"function": "read",
"class": "Maatwebsite\\Excel\\Reader",
"type": "->"
"file": "/workspace/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php",
"line": 261,
"function": "import",
"class": "Maatwebsite\\Excel\\Excel",
"type": "->"
"file": "/workspace/app/Http/Controllers/ImportController.php",
"line": 175,
"function": "__callStatic",
"class": "Illuminate\\Support\\Facades\\Facade",
"type": "::"
这是TemporaryFileFactory.php中抛出错误的那一行。
if (!file_exists($this->temporaryPath) && !mkdir($concurrentDirectory = $this->temporaryPath) && !is_dir($concurrentDirectory)) {
我完全不知道该如何开始解决这个问题。由于我没有修改任何代码,我只能假设某个库的新版本是罪魁祸首。但是我试着在composer.json中硬编码旧的库版本
"maatwebsite/excel": "3.1.19",
并运行 composer install,但似乎没有什么区别。如果有任何关于解决这个问题的线索,我将不胜感激。