I'm currently having some problems with creating symlink in my Laravel project. I'm currently on Windows 10 OS
and I'm using GitBash
.
I need to create symlink from storage/app/products_content
to public/products_content
For that, I'm using the following command:
ln -s storage/app/products_content public/products_content
The problem is, I'm getting the following error:
ln: failed to create symbolic link 'public/products_content': No such file or directory
But, when I try to create a symlink like this:
ln -s storage/app/products_content products_content
It creates it with no errors, but the folder is in my root
directory, not in /public
.
What causes this error, could it be permission issues? I'm running GitBash as administrator. Any help appreciated. If I need to provide any additional code, let me know.
Try going into the public
folder, then do:
ln -s ../storage/app/products_content products_content
And if that doesn't work, open Command Prompt (not PowerShell)
And "browse" to the public
folder, then do:
mklink /D products_content ..\storage\app\products_content
mklink
is the same as ln
except that the target and link is switched.
You may configure additional symbolic links in your filesystems configuration file. Each of the configured links will be created when you run the storage:link command:
'links' => [
public_path('storage') => storage_path('app/public'),
public_path('images') => storage_path('app/images'),
],
Just run: php artisan storage:link
and modify your path to: storage/products_content
The problem is when using windows
solution:
In my case, I am using laragon.
LINK CREATION (This is because the php artisan storage: link does not work on windows)
This would be similar to: php artisan storage: link
Take into account that to save in images it must be configured in the filesytem file (conf / filesytem)
'links' => [
public_path('storage') => storage_path('app/public'),
public_path('images') => storage_path('app/images'),
],
credits : more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With