Skip to content

Fix: invalid linking in workspaces for unused packages#4129

Merged
BYK merged 11 commits intomasterfrom
fix-workspace-linking
Aug 10, 2017
Merged

Fix: invalid linking in workspaces for unused packages#4129
BYK merged 11 commits intomasterfrom
fix-workspace-linking

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Aug 9, 2017

Summary

Fixes #4106. When a local package is listed under workspaces but that specific version is never used by anything, yarn still tries to install its bin links because it is listed as a dependency of the virtual workspace aggregator (but never get installed). This patch makes sure we have a location inside node_modules when trying to create bin links. It also fixes where we don't pass the proper location for workspaces root which may result in unexpected behavior under certain circumstances.

Test plan

Added a new test case which fails on master and passes with the fix.

Manual:

git clone git@github.com:babel/babel.git
yarn

Fails before the patch with latest nightly and passes after the patch.

@BYK BYK requested a review from arcanis August 9, 2017 11:59
arcanis
arcanis previously approved these changes Aug 9, 2017
@BYK BYK dismissed arcanis’s stale review August 9, 2017 15:49

Need another review since further updates revealed other bugs needing to be fixed


if (!linksToCreate.has(name) || isDirectRequire) {
if (
!(workspaceLayout && name === workspaceLayout.virtualManifestName) &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed? The virtual manifest should have no bin link, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing prevents it from having a bin definition. Also, this is the actual fix after merging from the master. I think the reason is this line: 7bd20fe#diff-306a2caea89d886b11134fb770d1ebf6R385

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right, updated.

@BYK BYK merged commit 22ff4f2 into master Aug 10, 2017
@BYK BYK deleted the fix-workspace-linking branch August 10, 2017 14:36
GulajavaMinistudio added a commit to GulajavaMinistudio/yarn that referenced this pull request Aug 11, 2017
Fix: invalid linking in workspaces for unused packages (yarnpkg#4129)
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

Successfully merging this pull request may close these issues.

"ENOENT: no such file or directory" when running Yarn for Babel

2 participants