Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to write file at location: to://app.js (Laravel 9 composer update on staging site)

So I just ran a composer updater on a staging site for an app I'm working on and i get this error after composer has generated it's package manifest:

> @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

I tried to rebuild the symbolic links with php artisan storage:link which was successful but still have the same error. I have also ran npm run dev and this finished too and created app.js (in public/js/ along with my other js files for this project). I have also just ran php artisan vendor:publish --tag=laravel-assets --ansi --force and as I expected I get the same error.

I assume this needs to be resolved for everything to work right despite it appearing to be correct? So what would I need to do to remove this error?

thanks

like image 235
Craig Stanfield Avatar asked Oct 18 '25 02:10

Craig Stanfield


1 Answers

I had a similar issue with Sail/Docker,
I've fixed it by changing the ownership of the folder ./vendor and ./public/vendor to my user

In my WSL connexion and my project folder, I've ran:

sudo chown -R $USER:$USER ./vendor/ ./public/vendor
like image 61
Jimmy Avatar answered Oct 20 '25 17:10

Jimmy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!