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

jonnydowe's avatar

Forge not creating all the folders in /storage

Hi,

I've just created a new DO droplet and used Forge to automatically Git pull my app into the new server. The only problem is that I get error:

InvalidArgumentException in Compiler.php line 36:
Please provide a valid cache path.

Google tells me I need the sessions, views and cache folders in storage/framework. I could SSH in and add this myself (the entire framework folder doesn't exist), but I'd like to have it done automatically within Forge. Am I doing something wrong here? I've not changed any of the default deployment settings.

0 likes
3 replies
ClaudioDekker's avatar

Hey everyone,

Bit late to the party (are there still any nacho's left?!), but since this thread just popped up as it got posted in our Laravel discord, I'll do my best as to answering why you're seeing this, and why it's not specifically Forge related but rather is an application error.

Basically, as the OP already indicated to have discovered, you need the 'storage' folder and all it's subfolders to be part of your application in order for it to function correctly. If you don't add them to your git repository, git won't create them whenever your repository is cloned, which will then cause the above error and possibly others. This also explains why you're not seeing this error locally on your own machine, as there these folders exist and were created when the Laravel application was first installed.

In either case, the solution is fairly simple: Make sure the 'storage' folder and it subfolders are committed as part of your application's repository. Of course, you don't want the cache files (files like c071422490d526a8aada046adf3a9c9fa0593468) to be committed, but Laravel conveniently includes .gitignore files that automatically ignore everything except for themselves and the required files.

Usually, this means that you can just directly commit the existing storage folder in your git repository (or copy it from here if you don't have it anymore for some reason), but if you're trying this and it doesn't work, make sure you didn't accidentally add the storage folder to your project's root .gitignore file.

Once committed, you can try cloning, installing or deploying your application again, and (assuming you didn't use php artisan config:cache already) everything should work right away.

Hope this helps!

2 likes
pmattheew's avatar

@ClaudioDekker I come here even later to the party lol but to thank you! I was removing a vendor folder that was commited to my repository and when I opened it in a cloud environment (gitpod) it wasn't working, throwing some errors (firstly file_put_contest() since /framework folder didn't exist and after invalid cache, because other folders didn't exist).

With your answer I could solve the issue and you gave a clear explanation, ty!

Please or to participate in this conversation.