NativePHP / laravel

Laravel wrapper for the NativePHP framework
https://nativephp.com
MIT License
3.13k stars 161 forks source link

Symlink bug on app boot-up #250

Open arnor01 opened 7 months ago

arnor01 commented 7 months ago

What happened?

I have made a NativePHP app which works great. Inside the application I added logging of the errors to a private slack channel, to keep tracks of errors. When testing the app I came accross the error symlink(): Argument #1 ($target) must be of type string, array given, but my application still worked so ignored it for some time. But the errors keeps coming back so I looked into it a bit and found out it happens everytime the storage:link command is ran, if I'm correct that will be run on every startup of the application.

It lucky doesn't bother the working of the application, but still wanted to address this here in case I can do something about it or that it actually is a bug.

symlink(): Argument #1 ($target) must be of type string, array given
#0 /Applications/{appname}/Contents/Resources/app.asar.unpacked/resources/app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(355): symlink(Array, '/Applications/P...')
#1 /Applications/{appname}p/Contents/Resources/app.asar.unpacked/resources/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php(49): Illuminate\Filesystem\Filesystem->link(Array, '/Applications/P...')
#2 /Applications/{appname}/Contents/Resources/app.asar.unpacked/resources/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Foundation\Console\StorageLinkCommand->handle()

How to reproduce the bug

Haven't had time too try it on a new project, but I think it happens on every build app. Or at least on Mac and Linux :)

Package Version

0.4.0

PHP Version

8.2

Laravel Version

10.25

Node Version

21.5

Which operating systems does with happen with?

macOS, Linux

Notes

No response

EPuigdemont commented 7 months ago

I have this issue as well.

I noticed that if I don't run the command php artisan storage:link --force I am seeing errors during the build command related to the storage folder not being found in the app/public/ directory.

After running the command and then building the application, the error is gone, and I haven't seen any other errors on my logs regarding this issue.

It seems like the default storage location is not set in the native app without running the command and so it looks for it in the wrong place.

arnor01 commented 7 months ago

@EPuigdemont I will try that whenever I have to update the application!

arnor01 commented 7 months ago

@EPuigdemont I have tried this today and it changed the error to: symlink(): Read-only file system. But that seems more like a device related problem than a NativePHP problem.

simonhamp commented 5 months ago

Interesting! I've not come across this. I'll look into it

kirilldakhniuk commented 5 months ago

@simonhamp I experienced the same error yesterday. For me php artisan storage:link --force did not change the error.

simonhamp commented 5 months ago

@KirillDakhnyuk Are you on Mac or Linux?

kirilldakhniuk commented 5 months ago

@simonhamp Mac M1, Laravel 10, PHP 8.1, Node 20.6.1.

simonhamp commented 5 months ago

@KirillDakhnyuk Is it blocking your app from running?

When and where do you see the error?

kirilldakhniuk commented 5 months ago

@simonhamp actually it did not. I see the error inside /Users/kirilldakhnyuk/Library/Application Support/clipstone/storage/logs/laravel.log every time when I start the app. Not sure if it help but I pushed the code https://github.com/KirillDakhnyuk/Clipstone

bedus-creation commented 1 week ago

Yeah I am also facing this issue