29

I'm trying to run the following artisan command:

php artisan storage:link

I get this error:

[ErrorException] symlink(): Protocol error

Can you help me to solve this.

This is my setup:

  • Windows 10 using vagrant with Homestead (v0.5.0) box
  • Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)
  • Laravel Framework version 5.3.6
  • PHP 7.0
user1810087
  • 5,146
  • 1
  • 41
  • 76
Elie Morin
  • 1,456
  • 3
  • 15
  • 35
  • Same on Laravel 5.4 and Homestead ((v5.4.0)) on Win 10 – Yevgeniy Afanasyev Aug 16 '17 at 22:11
  • For me, running as administrator was not enough, and I still got "Protocol error" when trying to create symlinks. Here was what worked: https://stackoverflow.com/a/60741351/470749 – Ryan Mar 18 '20 at 14:20

9 Answers9

78

Your problem probably is that you have to start your vagrant box as a system administrator.

So hit start type "cmd", right click it choose "Run as administrator". Navigate to your project, type "vagrant up". Retry the command.

Creating symbolic link on Homestead?

bleenders
  • 898
  • 7
  • 6
  • 7
    You'll want to vagrant halt if you are already up before switching to "Run as administrator". – Shawn Lindstrom Jul 11 '18 at 22:08
  • 2
    If you do not heed @ShawnLindstrom's advice, you will encounter the following error message: `Vagrant up: There was an error while executing 'VBoxManage', a CLI used by Vagrant` – Chad Feb 06 '19 at 22:31
5

First close vagrant with vagrant halt command, then run cmd as administrator, go to your homestead folder, start Vagrant with vagrant up and then you can run php artisan storage:link. For me it worked :)

  • 1
    Thanks for the solution, however this didn't work for me. But in my case I don't have a `users` folder in `~/storage` or a `storage` folder in `~/app/`. I'm not sure yet if that makes a difference or is suppose to exist. – Spencer Hill Aug 14 '21 at 20:49
2

enter image description here

Run cmd as Super Admin.

php artisan storage:link is OK.

tanteng
  • 648
  • 1
  • 6
  • 11
2

Try to run php artisan storage:link from host machine. This will wok

1

In my case I run vagrant as Administrator and is working.

Do not forget to vagrant halt on other machine and start new as administrator.

php artisan storage:link

Output:

The [/home/vagrant/code/public/storage] link has been connected to [/home/vagrant/code/storage/app/public].
The links have been created.

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
Marcin
  • 173
  • 12
0

You must login as cmd administrator, to do this click on the windows key and X. Then select the administrator system symbol. Do not forget to give her vagrant halt at the other terminal.

0

enter image description here

I spended a lot of time solving this problem, in my case my project was in a drive of storage with exFat format and on Window the command for make symbolic links is
mklink \J and this only works on storage drives with NTFS format .

enter image description here

I had to migrate my proyect to the storage with NTFS format.

enter image description here

I'm working with Docket, Laravel sail, Ubuntu 20.04 and voyager (is an admin panel for laravel) .

enter image description here

Ing Oscar MR
  • 769
  • 7
  • 7
0

If you continue to have this problem after you tried running CMD as admin, but had no luck.

Chances are that you use predis/redis, go to your .env file and put the standard drivers

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

Now halt your vagrant/homestead box, run homestead/vagrant up, try again and woopti :)

Now change back the drivers to redis

ii iml0sto1
  • 1,654
  • 19
  • 37
0

this solution worked for me : update your PHP on you computer (i.e. download from php.net) then open cmd as admin cd homestead -> vagrant up -> vagrant ssh -> cd code -> cd "your-APP" sudo apt update -> sudo apt upgrade exit (return to cmd) cd code -> cd "your-APP" -> php artisan storage:link