Symfony AssetMapper / importmap asset not found in CI
AssetMapper could not resolve an asset referenced from a template or importmap because the vendored files under assets/vendor were never installed, or the compiled manifest was not built before rendering in CI.
What this error means
A page render or asset-map:compile fails with "Unable to find asset ..." or "The "importmap" ... references a package that has not been installed", often after a fresh checkout.
In ImportMapManager.php line 320:
The importmap entry "bootstrap" references a package that has not been downloaded.
Run "php bin/console importmap:install" to download it.Common causes
Vendored assets were not installed
assets/vendor is typically gitignored, so a fresh CI checkout has no downloaded packages until importmap:install runs.
The asset map was not compiled
For a production-like render, asset-map:compile must run first; without it the manifest and hashed files are missing.
How to fix it
Install and compile assets before tests or build
- Run
importmap:installto download vendored packages. - Run
asset-map:compileif the app renders compiled asset paths. - Re-run the render or test.
php bin/console importmap:install
php bin/console asset-map:compileBuild front-end assets when using Webpack Encore
If the project uses Encore instead of AssetMapper, install and build the bundle before the app expects the manifest.
npm ci
npm run buildHow to prevent it
- Run
importmap:install(ornpm run buildfor Encore) as a CI step before rendering. - Cache
assets/vendorornode_modulesbetween runs to speed installs. - Do not commit compiled asset output; build it deterministically in CI.