javascriptphpsymfonyyarnpkgwebpack-encore

Error: Install stimulus to use enableStimulusBridge() while using yarn encore dev


I'm trying to install encore in my symfony 5 project, i followed the instructions in the stimulus bridge repository ( https://github.com/symfony/stimulus-bridge ) but when i try to run yarn encore dev this is what i get :

Running webpack ...

Error: Install stimulus to use enableStimulusBridge()

 yarn add stimulus --dev

Do you have any solution to help me ?


Solution

  • The problem you are encountering comes from the fact that the Symfony installation need the version 2.0 of stimulus and the line you are using installs the version 3.0. I've had the exact same problem today and reading the details of the logs helped my out:

    Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
    

    Once that line run I found out that the following line:

    yarn add stimulus --dev
    

    was installing the latest version. If you run:

    yarn add stimulus@2.0 --dev
    

    You should have the correct version.