You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using yarn and hoisting together causes yarn.lock to be ignored #852
If you try to use --npm-client=yarn and --hoist simultaneously, all your package's yarn.lock files will be ignored because lerna uses npm instead of yarn for everything except the top-level hoisted dependencies.
Expected Behavior
When using yarn as the npm client, all installed dependencies should satisfy any yarn.lock files that are present.
Current Behavior
lerna invokes npm --global-style instead of yarn in each of the packages, causing the yarn.lock to be ignored.
Possible Solution
We could forbid the combination of hoisting and yarn, or at least warn that it will give surprising results.
A more complete solution would mangle the contents of yarn.lock in a way analogous to what lerna already does for package.json in order to preserve the intended semantics.
Steps to Reproduce (for bugs)
In any lerna project, run lerna bootstrap --hoist --npm-client=yarn
Observe the resulting processes via ps or pstree and see that lerna is running npm instead of yarn.
😨 uhhh, pardon my shock, but that's asking us to reverse-engineer yarn. Definitely not happening. Warn about --npm-client=yarn + --hoist, sure, that's possible.
npm install --global-style is important to avoid improper transitive dependency resolution for non-hoisted dependencies. If you want to use yarn everywhere, yarn will have to be extended to support that, which is obviously out of scope for lerna itself.
Workspaces don't manage anything related to version decisions (git stuff, basically), so lerna isn't being replaced entirely. Just as we call out to npm/yarn as much as possible, workspaces will help simplify lerna's logic.
On Jun 11, 2017, at 02:18, Thomas Fritz ***@***.***> wrote:
@evocateur@MoOx Do you know what this would mean to lerna? Would Lerna then be obsolete? Or would Lerna just use this workspaces feature?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
If --hoist needs to do a leaf install (i.e., there are "unhoisted", possibly conflicting deps in the tree), then it will use npm because yarn does not support --global-install, which avoids leaking transitive dependencies incorrectly.
I spent a while trying to debug/create a reduced STR for why using --hoist plus yarn caused a package-lock.json to be created in one of the sub-package directories. Reading here it seems that this is because lerna has to fall back to npm for parts of the operation, and as such yarn + --hoist is not recommended.
If that's the case, a warning message during usage would save a lot of confusion :-) (And perhaps a note saying to use the workspaces support instead?)
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Activity
thomasfr commentedon Jun 1, 2017
I can confirm this. We are using
--hoistand--npm-client=yarntogether and when doing lerna bootstrap i can seenpm install --global-styleevocateur commentedon Jun 6, 2017
😨 uhhh, pardon my shock, but that's asking us to reverse-engineer
yarn. Definitely not happening. Warn about--npm-client=yarn+--hoist, sure, that's possible.npm install --global-styleis important to avoid improper transitive dependency resolution for non-hoisted dependencies. If you want to useyarneverywhere,yarnwill have to be extended to support that, which is obviously out of scope for lerna itself.MoOx commentedon Jun 10, 2017
Yarn will have a built in feature, called "workspaces" to offer a lerna like solution. More at yarnpkg/yarn#3294
thomasfr commentedon Jun 11, 2017
@evocateur @MoOx Do you know what this would mean to lerna? Would Lerna then be obsolete? Or would Lerna just use this workspaces feature?
evocateur commentedon Jun 11, 2017
chore: remove packages' yarn-lock
ebramanti commentedon Jun 20, 2017
So if using
yarnas thenpmClient, hoist will usenpminstead ofyarnalways?evocateur commentedon Jun 20, 2017
If
--hoistneeds to do a leaf install (i.e., there are "unhoisted", possibly conflicting deps in the tree), then it will usenpmbecauseyarndoes not support--global-install, which avoids leaking transitive dependencies incorrectly.edmorley commentedon Sep 29, 2017
I spent a while trying to debug/create a reduced STR for why using
--hoistplus yarn caused apackage-lock.jsonto be created in one of the sub-package directories. Reading here it seems that this is because lerna has to fall back to npm for parts of the operation, and as such yarn +--hoistis not recommended.If that's the case, a warning message during usage would save a lot of confusion :-) (And perhaps a note saying to use the workspaces support instead?)
fix: fail when --hoist and --yarn are used together
fix: fail when --hoist and --yarn are used together (#1063)
evocateur commentedon Nov 20, 2017
#1063 fixed this by making it error when
--npm-client yarnand--hoistare used together, released in v2.5.0.lock commentedon Dec 27, 2018
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.