The error Please provide a valid cache path usually means Laravel can’t find or write to its cache/storage directories during your deployment process. This commonly happens if the storage or one of its subfolders (like storage/framework/cache) does not exist or is not writable when the artisan commands (like package:discover) run during deployment.
Why is this happening after the Forge upgrade?
Forge recently changed the release deployment flow to use atomic (zero-downtime) deployments. In this setup, newly released directories may not yet have the storage symlinked/shared at the moment some deployment scripts run. If your composer install (and thus, artisan package:discover) is running before the shared storage directory is available, you’ll hit this error.
Solution Steps
1. Ensure You're Not Running Composer Scripts Before Storage Is Linked
By default, Forge runs composer install as part of the deployment process. The problem is that the @php artisan package:discover step (triggered as a composer script) is running before $ACTIVATE_RELEASE()—the Forge step that symlinks shared directories like storage and .env.
Fix:
Edit your deployment script in Forge to run composer install after $ACTIVATE_RELEASE(), and not as the default composer post-install script.
Example Deployment Script:
cd /home/forge/{domain}/current
# Run after the release is activated (shared paths are set up):
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan migrate --force
php artisan cache:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache
Note: Remove "@php artisan package:discover" or similar artisan commands from your composer.json scripts section, as Artisan commands should be run after the storage path is available.
2. Double Check Storage Permissions
Make sure the storage and bootstrap/cache directories are present in your shared paths in Forge and are writable by the web server user (forge or www-data!).
chmod -R ug+rwx storage bootstrap/cache
3. Check Your config:cache and env File
Make sure .env is also in the shared paths (which is default in Forge!), and after the release is activated, all the necessary environment configuration is present.
In Summary
- Move any
composer installsteps after$ACTIVATE_RELEASE(). - Remove any post-install script hooks that call artisan before storage is linked.
- Double check permissions.
Why is this the real fix?
Deployment scripts must ensure files and paths exist before hitting any framework code that expects them. With Forge's atomic release flow, it's easy to accidentally run artisan when needed shared paths aren't ready. By moving everything after $ACTIVATE_RELEASE(), you guarantee artisan will run successfully.
Let me know if you need more specific steps based on your composer.json or deployment script!