Skip to content

difference between npm and yarn behavior with nested dependencies  #3951

Closed
@sthuck

Description

@sthuck

Hi all,
I found a slight difference in behavior between npm (v4) and yarn 0.24.5 to yarn 0.27.5.

my package.json dependencies has something like this:

    "@types/angular": "~1.5.0",
    "@types/angular-mocks": "^1.5.0"

now @types/angular-mocks package.json looks like this:

 "dependencies": {
        "@types/angular": "*"
    },

In npm v4 and yarn 0.24.5, the @types/angular: "~1.5.0" I have in my package.json, satisfies this dependency, so I have only 1 @types/angular installed, in node_modules/@types/angular, and it's version is 1.5.23. Which is great.

But in yarn 0.27.5, I think the "@types/angular": "*" is being interpreted as a dependency on "latest".

Whatever the reason is, this causes me to now have 2 @types/angular packages.
Version 1.5.23 in node_modules/@types/angular, and version 1.6.26 (latest) in node_modules/@types/angular-mocks/node_modules/@types/angular. This obviously causes issues for typescript.

Im not sure if this is the intended behavior... If it is the intended behavior, and if someone by chance has an idea which commit is responsible for this change, I would love to know. Like I wrote, in 0.24.5 this issue didn't happen. I tried finding it myself but without success.

node: v6.9.5, npm: 4.1.2, yarn: 0.27.5

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