Randy_91's avatar

storage:links command not working

I am using Homestead and on windows 10 with laravel 7.

If I SSH into Homesteads and run the command php artisan storage:link I get the following error:

ErrorException

symlink(): Protocol error

at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:265 */ public function link($target, $link) { if (! windows_os()) { return symlink($target, $link); }

    $mode = $this->isDirectory($target) ? 'J' : 'H';


  +16 vendor frames

17 artisan:37 Illuminate\Foundation\Console\Kernel::handle()

A big part of my application will be in uploading images so I need to get this working on my development environment.

I have googled this but there are no clear cut answers that solved the problem. Can someone explain how to resove this?

0 likes
8 replies
newbie360's avatar

since you are sharing the host system folder to Homestead

so inside VM, you have no permission to override the Windows filesystem (NTFS)

if you can do that, means you run the VM as Administrators, It is very danger

you can make the symlink in Windows 10 instead of do it inside VM

in Windows can use (require Administrators to run the command)

mklink /J "D:\your-project-path\public\storage" "D:\your-project-path\storage\app\public"

Mac / Linux use

sudo ln -s "/your-project-path/public/storage" "/your-project-path/storage/app/public"

this also happened when you need to run

npm install && npm run dev

you need in Windows 10 install nodejs then run the command inside your project folder

Randy_91's avatar

Can I just run my VM as administrator and it will work?

newbie360's avatar

i never run VM as administrators, so i don't know

but it is very danger, it means inside the VM can run any code/command to hack/crash your host system

eg, create a symlink point to your Host C:\Windows , My Document etc

thats why better make the link by youself

laracoft's avatar

@randy_91 I use my own CentOS VirtualBox and not homestead, but I faced this protocol error before and I'm assuming homestead is running VirtualBox, google for SharedFoldersEnableSymlinksCreate.

Essentially, you have to run this command for symlinks to work on shared folders.

VBoxManage setextradata "<VIRTUAL_MACHINE_NAME>" VBoxInternal2/SharedFoldersEnableSymlinksCreate/<SHARE_FOLDER_NAME> 1	
newbie360's avatar

@laracoft i haven't tested if SharedFoldersEnableSymlinksCreate enabled

can you try ssh to VM, create a symlink in the share folder , point to your host system any directory o.0?

viorel's avatar
viorel
Best Answer
Level 6

I presume you are using Vagrant and VirtualBox to power your Homestead. In such a case this is how you can solve your error:

  • vagrant halt first to stop your VM then run command prompt as an administrator
  • CD into the folder where you have Homestead installed and run vagrant up
  • after the machine boots up run vagrant ssh and then CD to the folder where you want to run php artisan storage:link command and it should work

This approach works for me every time.

3 likes

Please or to participate in this conversation.