Skip to content

Yarn upgrade creates duplicate dependency resolution #3967

Closed as not planned
Closed as not planned
@xdumaine

Description

@xdumaine

Do you want to request a feature or report a bug?
Bug

What is the current behavior?

I have a dependency tree like this

app
|-- shared-dep@^1.0.0
|-- dep-1
|   |-- shared-dep@^1.1.0
|-- dep-2
     |-- shared-dep@^1.1.0

And when I yarn upgrade shared-dep (say when 1.2.0 is released) it causes duplication in yarn.lock where the resolution for shared-dep doesn't change for the version pulled in by dep-1 and dep-2 and it adds a new (duplicate) resolution for shared-dep so that now it's pulling in 1.1.0 and 1.2.0.

Before upgrade:

"shared-dep@^1.1.0", "[email protected]":
  version: "1.1.0"
  resolved "..."

After upgrade:

"shared-dep@^1.1.0", "[email protected]":
  version: "1.1.0"
  resolved "..."

"shared-dep@^1.2.0":
  version: "1.2.0"
  resolved "..."

If the current behavior is a bug, please provide the steps to reproduce.

  1. Clone https://github.com/xdumaine/yarn-issue-3967
  2. Run yarn upgrade commander@^2.4.0
  3. Observe that the new yarn.lock file has two overlapping entries for commander:
    commander@^2.3.0:
      version "2.3.0"
      resolved "https://registry.yarnpkg.com/commander/-/commander-.3.0.tgz#fd430e889832ec353b9acd1de217c11cb3eef873"
    
    commander@^2.4.0:
      version "2.11.0"
      resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
    

What is the expected behavior?

Having a single commander entry in the lockfile:

commander@^2.3.0, commander@^2.4.0:
  version "2.11.0"
  resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"

Please mention your node.js, yarn and operating system version.

OS X 10.12.5
node v8.9.0
yarn v1.3.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions