Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Rage6's avatar
Level 1

Too many symbolic links

I'm using Laravel (v.10.32.1) with Vue, and I'm struggling to solve a problem that started when I tried to establish symbolic links between the storage/app/public directory and the public directory. I followed the official documentation (https://laravel.com/docs/10.x/filesystem#the-public-disk), but I changed it slightly so that the subdirectories made more sense to me. I tinkered around, simply deleting new directories, until I liked the layout. Unfortunately, I soon realized that this is a bad move because my npm run dev command only gives me an error (see below) because the symbolic links of the deleted directories still remain. I tried php artisan storage:unlink as it says in the documentation, but that command only gives me Command "storage:unlink" is not defined. Do you have any idea how I can remove these “symbolic ghosts” possessing my “storage closet”?


Error: ELOOP: too many symbolic links encountered, stat '/Applications/MAMP/htdocs/Email_Practice/storage/app/public/images'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (file:///Applications/MAMP/htdocs/Email_Practice/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:53803:10)
    at FsEventsHandler._handleFsEventsSymlink (file:///Applications/MAMP/htdocs/Email_Practice/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:53029:18) {
  errno: -62,
  code: 'ELOOP',
  syscall: 'stat',
  path: '/Applications/MAMP/htdocs/Email_Practice/storage/app/public/images'
}

0 likes
4 replies
LaryAI's avatar
Level 58

It seems like you've encountered an issue with symbolic links that have been incorrectly set up, leading to a loop. The php artisan storage:unlink command you mentioned does not exist in Laravel, which is why you're seeing the "Command not defined" error. Instead, Laravel provides a command to create the link, but not to remove it.

Here's how you can manually remove the problematic symbolic links and set them up again:

  1. Navigate to your public directory in your Laravel project.
  2. Look for the symbolic link that corresponds to the storage/app/public directory. It's usually named storage.
  3. Remove the symbolic link. You can do this with the rm command in your terminal:
rm public/storage
  1. After removing the symbolic link, you can recreate it using the Laravel artisan command:
php artisan storage:link

This command will create a proper symbolic link from public/storage to storage/app/public.

If you have created additional symbolic links manually that are causing problems, you will need to identify and remove them as well. You can use the ls -l command in the terminal to list the contents of a directory and identify symbolic links (they are usually indicated with an -> pointing to the target directory).

For example, if you have created a symbolic link inside storage/app/public/images, you would navigate to that directory and remove the link:

cd storage/app/public/images
ls -l # to identify the symbolic link
rm name_of_the_symbolic_link

Replace name_of_the_symbolic_link with the actual name of the symbolic link you want to remove.

After cleaning up the symbolic links, you should be able to run npm run dev without encountering the ELOOP error. If you continue to have issues, make sure there are no nested symbolic links or loops by carefully checking the directory structure and the links within it.

Snapey's avatar

nothing magical about symbolic links. you can still see them in the directory listing if they exist

Rage6's avatar
Level 1

@Snapey Yeah, I simply had to remove the directory using the terminal. I had already "removed" that directory with my basic text editor (Visual Studio Code) before my post, but it must not have actually been removed. The fact that it wasn't visually on the root tree on the editor had made me assume that it was truly removed. This then led me to theorize that there was some kind of overall list of symbolic links, and that I needed to remove the "deleted" directory from that list too. For future references, do you have any idea why php artisan storage:unlink doesn't work for me?

Snapey's avatar

@Rage6 it only removes one link the one in public for storage

Please or to participate in this conversation.