Upgrading CiviCRM is usually a straightforward process, but it is not uncommon to encounter a blank System Status page or a broken New Mailing interface immediately after. If you open your browser's developer console and see a failing GET request for a file like angular-modules.xxxx.js, you are likely dealing with an Angular path or caching issue.
These errors typically occur because CiviCRM uses a dynamic bundling system for its Angular components. When the system cannot locate these generated files or the paths are misconfigured, the entire Angular application fails to bootstrap. In this guide, we will explore the most common causes of this issue and provide step-by-step solutions to get your CiviCRM dashboard back online.
The Root Cause: Path and Directory Mismatches
The most frequent culprit behind the angular-modules.js 404 error is a mismatch between your Image Directory and your Image Upload URL. While it may seem counterintuitive, CiviCRM historically uses these specific settings to determine where to write and read cached Angular files.
If CiviCRM is writing the cache files to one physical directory on the server but the browser is looking for them at a different URL, the Angular load will fail. This often happens in multi-site Drupal installations or when moving a site from a subdirectory to a root domain.
How to Fix Path Mismatches
- Navigate to Administer > System Settings > Directories. Ensure the Image Directory is set to an absolute server path (e.g.,
/var/www/html/sites/default/files/civicrm/persist/contribute/). - Navigate to Administer > System Settings > Resource URLs. Ensure the Image Upload URL matches the public-facing version of the directory above (e.g.,
https://example.org/sites/default/files/civicrm/persist/contribute/). - Ensure these folders have the correct write permissions for your web server user (usually
www-dataorapache).
Managing the Asset Cache
CiviCRM bundles its JavaScript and CSS into optimized files to improve performance. However, during an upgrade or a server migration, this cache can become stale or point to non-existent files. If you are in a pinch and need to restore functionality immediately, you can temporarily bypass this system.
Disabling Asset Cache
Go to Administer > System Settings > Debugging. Locate the Asset Cache setting and set it to Off.
Note: While this often fixes the immediate visibility of the System Status page, it is a workaround rather than a permanent fix. You should eventually resolve the underlying path issues and re-enable the cache for better performance.
Cross-Origin Resource Sharing (CORS) and SSL Issues
Modern browsers enforce strict security policies regarding where files are loaded from. If your CiviCRM Resource URLs are configured with http:// but your site is running on https://, or if you are loading assets from example.com while the user is visiting www.example.com, the browser may block the Angular scripts.
Common CORS Fixes
- Enforce Absolute URLs: Ensure all entries in Administer > System Settings > Resource URLs use absolute paths (starting with
https://www.) rather than relative paths. - Force SSL: In the Resource URLs settings, check the option to Force SSL. This ensures that CiviCRM generates all links using the HTTPS protocol, preventing mixed-content errors.
- Redirect Consistency: Ensure your web server (Nginx or Apache) consistently redirects users to either the
wwwornon-wwwversion of your site to match your CiviCRM configuration.
Environment-Specific Solutions
Depending on your CMS and your installation method, you may need to take additional steps to ensure Angular assets are accessible.
For Drupal 9 and 10 Users
If you are running a modern Drupal installation managed via Composer, CiviCRM assets may need to be explicitly published to the web directory. Run the following command from your project root:
composer civicrm:publish
This command symlinks or copies the necessary assets into the public-facing directory, ensuring the web server can serve them.
The OAuth Extension Requirement
In some edge cases, particularly in newer versions of CiviCRM, the system relies on the OAuth extension for certain internal API calls that Angular components utilize. If you have tried all path-related fixes and the page remains blank, ensure the OAuth extension is installed and enabled via Administer > System Settings > Extensions.
Best Practices to Avoid Angular Failures
To prevent these issues during future upgrades, follow these best practices:
- Clear Caches Thoroughly: After any configuration change, clear the CiviCRM cache via the UI or using CV: cv flush. Also, clear your CMS cache (e.g., drush cr).
- Verify Resource URLs: Always double-check your Resource URLs after an upgrade. If you see a file path in your console that looks "wrong" (e.g., it contains sites/default on a site that doesn't use that directory), you likely have a hardcoded override in your civicrm.settings.php file.
- Check Browser Console: Always keep the browser console open during troubleshooting. A 403 Forbidden error points to permissions, while a 404 Not Found points to pathing, and a CORS error points to domain/protocol mismatches.
Frequently Asked Questions
Why does CiviCRM use the Image Directory for Angular files?
Historically, the Image Directory was one of the few directories guaranteed to be web-accessible and writable by the application. CiviCRM uses this location to store "persisted" assets, including the dynamically generated Angular module bundles.
I fixed the URLs but the error persists. What now?
Check your civicrm.settings.php file for any hardcoded overrides of $civicrm_setting['Directory Settings'] or $civicrm_setting['URL Settings']. Settings defined in the PHP file will override anything you enter in the web interface.
Is it safe to leave the Asset Cache disabled?
On small sites with low traffic, you might not notice a difference. However, on larger installations, disabling the Asset Cache will result in significantly more HTTP requests and slower page load times for your administrative users.
Wrapping Up
Fixing a blank CiviCRM System Status page usually comes down to aligning your physical file paths with your web-accessible URLs. By ensuring your Image Directory and Image Upload URL are perfectly synced, and by verifying your SSL and CORS settings, you can resolve the majority of Angular load errors. If all else fails, a quick toggle of the Asset Cache or a composer civicrm:publish command can often bridge the gap.