Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared dependencies of dependencies resolution question #1272

Closed
otbe opened this issue Oct 19, 2016 · 3 comments
Closed

Shared dependencies of dependencies resolution question #1272

otbe opened this issue Oct 19, 2016 · 3 comments

Comments

@otbe
Copy link

otbe commented Oct 19, 2016

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

Please mention your node.js, yarn and operating system version.
yarn 0.16, node 6.5.0 and OS X 10.12.1

What is the current behavior?
npm and yarn differ in the way how deps of deps are resolved.

For example:
There is a public module called something and its latest version is 0.14.41.
module As package.json:

{
   "name": "moduleA",
   "version": "1.0.0",
   "dependencies": {
      "something": "^0.14.30"
   }
}

module Bs package.json:

{
   "name": "moduleB",
   "dependencies": {
      "something": "0.14.40" 
      "moduleA": "^1.0.0"
   }
}

npm will install one version (0.14.40) of something in module Bs node_modules folder, but yarn will install two versions. 0.14.0 in module Bs and 0.14.41 in module As node_modules folder.

Compared to npm this leads to unexpected behavior for bundlers and other processing tools (like TS). As a side note: something is a public scoped package, maybe this is related to the scoping issues.

What is the expected behavior?
I like the way how npm solves this problem :)
I know the --flat option for yarn install, but I don't want to choose between version 1.0.0 and 2.0.0of a package. I think yarn should simply install semver compatible versions as flat as possible. In my example above 0.14.40 matches requirements from both modules (I think this is what npm does).

Maybe my understanding is wrong, but whats the expected behavior in this case?
Thanks!

@davidmerrique
Copy link

I think this is the same as or related to #1158

This is definitely a problem.

@otbe
Copy link
Author

otbe commented Oct 20, 2016

Indeed! Sorry for duplicate, searched a while for an related issue 👍

@sebmck
Copy link
Contributor

sebmck commented Oct 26, 2016

Fixed via #1477.

@sebmck sebmck closed this as completed Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants