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

Yarn installs extra versions of @types/node unnecessarily #7084

Closed
mikl opened this issue Mar 6, 2019 · 1 comment
Closed

Yarn installs extra versions of @types/node unnecessarily #7084

mikl opened this issue Mar 6, 2019 · 1 comment

Comments

@mikl
Copy link

mikl commented Mar 6, 2019

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

🐞🐛

What is the current behavior?

I have "@types/node": "^10.12.10" in my devDependencies. Yarn correctly installs @types/node@10.12.29 in node_modules/@types/node, but it also installs @types/node@11.10.4 in the node_modules folder of anything that depends on "@types/node": "*".

There seems to be no way to prevent Yarn from installing these typings for Node v11.

This causes problems, because having multiple versions of the same typings installed really confuses the TypeScript compiler, and since we're using Node v10, we don't want the typings for v11 installed.

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

Check out the Git repo at https://github.com/mikl/yarn-duplicate-versions-problem

Run yarn. Run yarn why @types/node. Notice that it finds multiple versions installed.

Like this:

% yarn why @types/node
yarn why v1.13.0
[1/4] 🤔  Why do we have the module "@types/node"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@types/node@10.12.29"
info Has been hoisted to "@types/node"
info This module exists because it's specified in "devDependencies".
info Disk size without dependencies: "692KB"
info Disk size with unique dependencies: "692KB"
info Disk size with transitive dependencies: "692KB"
info Number of shared dependencies: 0
=> Found "@types/pg#@types/node@11.10.4"
info This module exists because "@types#pg" depends on it.
info Disk size without dependencies: "712KB"
info Disk size with unique dependencies: "712KB"
info Disk size with transitive dependencies: "712KB"
info Number of shared dependencies: 0
✨  Done in 0.09s.

What is the expected behavior?

Since the 10.x version required by "@types/node": "^10.12.10" should also satisfy the requirement "@types/node": "*", Yarn should only install one copy of @types/node, v10.12.29.

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

Node v10.15.2
Yarn 1.13.0
macOS Mojave 10.14.3

@arcanis
Copy link
Member

arcanis commented Mar 6, 2019

Cf this thread: #6695 (comment)

@arcanis arcanis closed this as completed Mar 6, 2019
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

2 participants