【问题标题】:Unable to write file at location: to://app.js (Laravel 9 composer update on staging site)无法在位置写入文件:to://app.js(暂存站点上的 Laravel 9 作曲家更新)
【发布时间】:2022-08-11 16:29:23
【问题描述】:

所以我刚刚在一个暂存站点上为我正在开发的应用程序运行了一个作曲家更新程序,在作曲家生成它的包清单后我得到了这个错误:

> @php artisan vendor:publish --tag=laravel-assets --ansi --force

   League\\Flysystem\\UnableToWriteFile 

  Unable to write file at location: to://app.js.

  at vendor/league/flysystem/src/UnableToWriteFile.php:24
     20▕     private $reason;
     21▕ 
     22▕     public static function atLocation(string $location, string $reason = \'\', Throwable $previous = null): UnableToWriteFile
     23▕     {
  ➜  24▕         $e = new static(rtrim(\"Unable to write file at location: {$location}. {$reason}\"), 0, $previous);
     25▕         $e->location = $location;
     26▕         $e->reason = $reason;
     27▕ 
     28▕         return $e;

      +24 vendor frames 
  25  artisan:37
      Illuminate\\Foundation\\Console\\Kernel::handle()
Script @php artisan vendor:publish --tag=laravel-assets --ansi --force handling the post-update-cmd event returned with error code 1

我尝试使用php artisan storage:link 重建符号链接,这很成功,但仍然有相同的错误。我还运行了npm run dev,这也完成了并创建了 app.js(在 public/js/ 以及我用于该项目的其他 js 文件中)。我也刚刚跑了php artisan vendor:publish --tag=laravel-assets --ansi --force,正如我所料,我得到了同样的错误。

我认为这需要解决,以使一切正常工作,尽管它看起来是正确的?那么我需要做些什么来消除这个错误呢?

谢谢

    标签: php laravel composer-php


    【解决方案1】:

    我对 Sail/Docker 也有类似的问题,
    我已通过将文件夹 ./vendor 和 ./public/vendor 的所有权更改为我的用户来修复它

    在我的 WSL 连接和我的项目文件夹中,我运行了:

    sudo chown -R $USER:$USER ./vendor/ ./public/vendor
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-07
      • 2016-09-06
      • 2022-06-13
      • 2021-12-16
      • 1970-01-01
      • 2017-09-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多