-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 add
with workspaces doesn't install to workspace root
#4513
Comments
I was able to replicate this behavior locally with the repo provided. @bestander I'm guessing this was not intentional? |
Yeah, for sure does not look like it is intentional. |
**Summary** Fixes yarnpkg#4706, fixes yarnpkg#4359, refs yarnpkg#4513. `this.config.cwd` was being used as the root for bin link paths, rather than `this.config.lockfileFolder`. **Test plan** - Added tests for `add` and `remove` commands (yarnpkg#4706) - Added test for `install` command (yarnpkg#4359)
This now works for me using latest yarn Nightly. ie:
Note: |
@edmorley yay, thanks! Closing then :) |
@edmorley I'm most probably missing something, but as I read it, the behavior that you're showcasing is exactly the bug that I'm describing. |
Ah sorry - seems like I inverted the expected-actual from the OP when comparing to my results. However repeating your STR (that don't have the
Repeating my steps from above (that used So it seems there are a few issues:
|
I think it would be the most intuitive if a Does this expectation make any sense? What is the recommended workflow for adding a dependency to a workspace? FYI, my current workflow is manually editing |
@BYK @edmorley I think this issue should be reopened. I just went over the test repo again, currently with |
Reopening because the issue seems to depend on the workspace location. If you use
then adding a package in a workspace project properly installs it to the workspace root However if you use
then adding a package in a workspace project installs it to that project (reproduced in yarn v1.7.0) |
I just came across this exact issue with
and yarn v1.13.0. I tried both This really defies everything that it seems like workspaces are supposed to fix, so it's making me reconsider my setup now. |
This is still happening for me using yarn v3.0.2 |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Running
yarn add foo
inside a workspace directory does two unexpected things;/my-workspace/node_modules/foo
, whereas I would expect it to install it to the workspace root, e.g.:/node_modules/foo
my-workspace
to/my-workspace/node_modules
If the current behavior is a bug, please provide the steps to reproduce.
See also: https://github.com/edorivai/workspace-test
workspace-1
), and add a minimalpackage.json
file.package.json
, set"workspaces": [ "./*" ]
What is the expected behavior?
I would have expected
With node modules being installed at the root level.
Please mention your node.js, yarn and operating system version.
The text was updated successfully, but these errors were encountered: