Bootstrap cannot find symfony/stimulus-bundle

Bootstrap cannot find symfony/stimulus-bundle

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Bootstrap cannot find symfony/stimulus-bundle

You are likely staring at a build error that claims ./assets/bootstrap.js contains a reference to @symfony/stimulus-bundle, yet you are certain you have installed the bundle via Composer. This specific failure message is a classic symptom of a dependency resolution conflict rather than a missing file in your filesystem. The issue often stems from version incompatibilities between the Symfony framework core and the Webpack Encore bridge packages, particularly when moving between major versions like 6.x and 7.x.

When you run npm run watch, Webpack attempts to resolve all imports within your asset graph. If your bootstrap.js file (or a library bundled with it) tries to import Stimulus using the legacy path @symfony/stimulus-bundle, but your package.json relies on the modern, standalone packages provided by the Hotwire ecosystem, Webpack throws a "Module not found" error.

The root cause here is that @symfony/stimulus-bundle is technically a PHP package installed via Composer, not a JavaScript package managed by npm. However, Webpack Encore requires specific JavaScript counterparts to function correctly in the browser: @hotwired/stimulus and @symfony/stimulus-bridge.

If you are following guides that were written for Symfony 6, they often rely on these legacy package names or assume a different setup where the bundle's internal wiring was more lenient. In Symfony 7, the architecture shifted significantly. The PHP bundle no longer automatically injects the old JavaScript entry point in a way that is compatible with modern package.json configurations without explicit bridging.

To resolve this, you must ensure your frontend dependencies align with your backend version. If you are on Symfony 7, you cannot simply rely on the default output of symfony new --webapp if it pulls in an older version of the Encore bundle that expects the old Stimulus packages.

Here is how to fix the configuration:

  1. Check your package.json: Ensure you have explicitly installed the modern Hotwire packages. Run the following commands to add the correct NPM dependencies:
    npm install @hotwired/stimulus @symfony/stimulus-bridge
    
  2. Update the Encore Configuration: Open your webpack.config.js. You need to explicitly configure the Encore bridge to use the new Stimulus package and ensure it is built correctly. Add or update the configuration in your build.js file:
    Encore
        .setWebpackConfig((config) => {
            // Ensure the loader for the stimulus bridge is handled if needed
            return config;
        })
        // ... other configurations
    ;
    
    export default Encore.getWebpackConfig();
    
  3. Verify the Imports: If you are writing custom code in assets/bootstrap.js, ensure you are importing Stimulus using the correct modern path:
    import {Stimulus} from '@hotwired/stimulus';
    const application = Stimulus.start();
    

The error message suggesting a typo or moved file is misleading because the file hasn't moved; the resolution logic in Webpack is failing to match the legacy name against the modern package registry. By switching your environment to use @hotwired/stimulus, you align with the current Symfony 7 standards where the PHP bundle acts as a server-side controller, and the JavaScript bridge handles the client-side initialization independently.

If you are still facing issues after updating dependencies, check your composer.json to ensure symfony/webpack-encore-bundle is compatible with your specific Symfony version. Sometimes, pinning the Encore bundle to a version that supports Symfony 7 explicitly can resolve silent mismatches.

For those looking for deeper integration patterns or advanced asset compilation strategies within the Hotwire ecosystem, resources like the official Symfony documentation provide updated examples that reflect these architectural changes. Additionally, if you are exploring similar PHP frameworks with robust frontend tooling, Laravel offers an alternative approach to asset management through Vite, which handles these versioning conflicts differently and might be worth investigating for future projects.

Our network