4

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!

Community
  • 1
  • 1

1 Answers1

5

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.

Daniel Buckmaster
  • 7,108
  • 6
  • 39
  • 57
  • For those of you running spark on a cloud provider, you can add this to your composer.json [post-install-cmd](https://getcomposer.org/doc/articles/scripts.md#defining-scripts): `ln -sr storage/app/public public/storage` – Christof Jul 29 '16 at 11:50
  • 1
    If you are running Homestead, or another Vagrant-type Linux VM, as your development environment, you must create the symlink from inside your VM. – Jeremy Anderson Dec 02 '16 at 16:05