Search code examples
phplaravellaravel-spark

Laravel Spark Symlink for Profile Pictures is not Working


I'm having some troubles with the symbolic linking of my storage directories in a fresh Spark installation. I checked the Spark docs (found here), and I've tried to follow the instructions under the Linking the Storage Directory Section. But, when I run the command

ln -s /storage/app/public /public/storage

I get the following error:

ln: failed to create symbolic link ‘/public/storage’: No such file or directory.

This is odd because I've checked via the command line and my editor, and the directory does exist.

I've also tried using

ln -sr /storage/app/public /public/storage as suggested here.

This did create the symbolic link. But in my application, I still get 404 errors.

For some additional information that may help: I'm using a Homestead environment to develop and I set up my project with the Spark Installer. I also checked out this other Stack Overflow Question, but it suggested that I take the same steps that I have already tried.

Thank you for the help!


Solution

  • Try ln -s $(pwd)/storage/app/public $(pwd)/public/storage from your project directory (the directory that has composer.json in it). The command you're running tries to make a link from /storage... which is in the root of the filesystem. You do need to use an absolute path when running ln, but you need to use the full path to your project. For example, in Homestead my path is /home/vagrant/project-name/storage/app/public.