Skip to content

npm dependency resolution error with Symfony-provided package.json file #246

Open
@mbtuckersimm

Description

@mbtuckersimm

My app is using Symfony 5.4 because we are still stuck on an ancient version of PHP (7.2.24, currently). We are using Symfony Flex. I ran

composer require symfony/webpack-encore-bundle

which resulted in webpack-encore-bundle v1.17.2 being installed.

Then, when I ran npm install to install the dependencies, I got this error in dependency resolution:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @symfony/webpack-encore@4.7.0
npm error Found: @symfony/stimulus-bridge@4.0.1
npm error node_modules/@symfony/stimulus-bridge
npm error   dev @symfony/stimulus-bridge@"^4.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional @symfony/stimulus-bridge@"^3.0.0" from @symfony/webpack-encore@4.7.0
npm error node_modules/@symfony/webpack-encore
npm error   dev @symfony/webpack-encore@"^4.0.0" from the root project
npm error
npm error Conflicting peer dependency: @symfony/stimulus-bridge@3.2.3
npm error node_modules/@symfony/stimulus-bridge
npm error   peerOptional @symfony/stimulus-bridge@"^3.0.0" from @symfony/webpack-encore@4.7.0
npm error   node_modules/@symfony/webpack-encore
npm error     dev @symfony/webpack-encore@"^4.0.0" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

The package.json file that appears when I run the composer require command includes these two lines:

"@symfony/stimulus-bridge": "^4.0.0",
"@symfony/webpack-encore": "^4.0.0",

which are what's causing the problem, since webpack-encore v4.7.0 declares a dependency on stimulus-bridge ^3.0.0.

What's going on here? I didn't change the package.json at all. Is there something about my configuration that's resulting in Symfony providing a requirements file with conflicting dependencies? Is there some way to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions