-
Notifications
You must be signed in to change notification settings - Fork 604
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
[rush] pnpm fails to properly find peer dependencies when in both local and remote packages #1974
Comments
Saw that rush 5.27.1 was released an hour ago. This bug reproduces in 5.27.1 as well. It also reproduces with pnpm at 5.2.6 |
I'm curious if this is the same issue as my issue (which is the one before your issue): #1973 |
Can confirm that this bug is resolved using workspaces (PR here: #1938). |
I'm now using pnpm workspaces. Thank you! Even still, I ran into another flavor of this bug with unmet peer dependencies in sub-sub dependencies of webpack. I can't vouch for the guaranteed causality of this statement: it seems to have happened when I added webpack as a devDependency in one of my packages that was itself a devDependency of another one of my packages (and which also had a devDependecy of webpack). To spell that out: my-rush-managed-package:
devDependencies:
- my-other-rush-managed-package
- webpack
my-other-rush-managed-package:
devDependencies:
- webpack # adding this caused bug to occur Interestingly, switching from [email protected] to [email protected] resolved the issue! So, the main question: are there known problems with using pnpm@5 with rush? |
No. The warnings that appear for deprecated commands are okay, Rush has just not been updated to avoid passing these arguments. You should be able to use PNPM 5. However, if you do encounter any issues with it, please let us know since we will want to fix those. |
@D4N14L first off, thanks for the quick reply! Second, feel free to close this bug if that fits with your workflow. I'm not sure what your team's conventions are around closing bugs, but at present, my issue is resolved. I'll reopen if I encounter similar issues. Third, thanks for your hard work on Rush. Our team over at Adobe recently adopted it, and we love it. |
@joelrbrandt great, glad to hear it! Since your issue is resolved, I'll close out this bug for now. If you run into any other issues/have any feature suggestions, feel free to open up another bug, or reach out over Gitter :) |
Is this a feature or a bug?
Please describe the actual behavior.
Repo which demonstrates the bug: https://github.com/joelrbrandt/rush-peer-dep-test
Steps to repro:
rush init
using rush 5.27.0. SetstrictPeerDependencies
totrue
.lib
) with a peerDependency (e.g.,eslint@*
)client
) which depends on BOTH the first local package (lib
) and some remote package with the same peerDependency (e.g.,@typescript-eslint/[email protected]
)eslint
) as a dependency of the second local package (client
)rush update
The above repo demonstrates this scenario. The
main
branch fails onrush update
. However, thefixed
branch, which moveseslint
from being a peerDependency to a regular dependency inlib
, succeeds.Comparison of
main
andfixed
: https://github.com/joelrbrandt/rush-peer-dep-test/compare/fixedThe rush configuration in this repo is the default generated by
rush init
from rush 5.27.0, with two exceptions:"strictPeerDependencies"
is set totrue
, and"resolutionStrategy"
is explicitly set to"fewer-dependencies"
(though I believe this is rush's default). I also .gitignored thepnpm-lock.yaml
file for ease of testing.I have verified that this happens with other combinations -- it first cropped up for me with
ts-loader
and one of my local libraries (a shared eslint config) both having peerDependencies on TypeScript. I thought it might be something wrong with thets-loader
package, so I tried another example, and found the one present in the above repo.What is the expected behavior?
peerDependencies are correctly seen as being met.
Workarounds
Option 1: Don't use any peerDependencies in any local packages. This is not an ideal workaround because sometimes peerDependencies really are the right solution (e.g., when publishing shared eslint configs)
Option 2: Note: this does not work with
rush deploy
(see below). Write areadPackage
hook which moves the peerDependency in the remote package to a real dependency in that same package. This is a bit sketchy because there's no longer anything enforcing that the dependency be listed somewhere downstream as a real dependency. So, a developer could accidentally publish a package from this repo which does not correctly list all its dependencies.Update: The workaround option 2 seems to be incompatible with
rush deploy
. I couldn't find a good way to get detailed error messages fromrush deploy
. However, when I munge peerDependencies using thereadPackage
hook, my deploys fail with the errorERROR: Cannot convert undefined or null to object
. If I switch to workaround 1 (and change nothing else about my config), deploys work fine.If this is a bug, please provide the tool version, Node.js version, and OS.
The text was updated successfully, but these errors were encountered: