-
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
[workspaces / lerna] Unexpected version of a package installed inside a dependency #5978
Comments
Would it be possible to make a minimal reproduction project that demonstrates the issue? I'm guessing something includes |
I'll try to come up with a repo this weekend :) |
I just came into a similar situation. I have a module with this dependencies and forcing nohoist on a particular package:
And I got and old version of React installed inside
Here are the dependencies of
As you can see, no devDependencies this time. Does yarn look into |
what gets reported if you run if you delete node_modules and yarn.lock and rerun install, does it still happen? Maybe react was installed once with an old version and an existing yarn.lock is preserving it? |
I've been doing clean installs all the time, deleting root |
I've noted the same behavior with The pattern I'm seeing is that the version hoisted at the root (
And to recap, peer dependencies:
But I think Thanks for looking into this! PS: This may be happening with other packages, but only these I've found to be problematic when you have two versions loaded. |
@rally25rs finally came up with a repo to reproduce the issue with React and react-redux: https://github.com/SebastianBogado/yarn-peer-dependencies |
Hi @rally25rs, have you had the chance to take a look at this? My team has also stumbled upon this. |
#7088 I meet this. For Nuxt v2 (webpack v4) project and any other project built on webpack v3, the html-webpack-plugin will resolve a wrong webpack version. |
Hi, do we have any updates for this? |
Do you want to request a feature or report a bug?
Bug maybe.
What is the current behavior?
In the context of a lerna monorepo with yarn workspaces, I'm getting an unexpected version of a dev dependency installed inside a dev dependency itself. Here's the folders structure (simplified):
Note: there's a lot of stuff in
node_modules
that I excluded and also insideapplications
folder there are other modules with many publishable packages.My app has a direct dependency on
styled-components
andjest-styled-component
as a dev dependency. Here's a part of ourpackage.json
:So far so good.
The unexpected installed module is inside
jest-styled-components
. As you can see, it gets installed its own version ofstyled-components
. That's OK, I can handle that. I'm not running with the production flag anyways. But if you check itspackage.json
:jest-styled-components
expectsstyled-components@^3.2.0
as a dev dependency.So why the
v2.2.4
gets installed insidejest-styled-components
?If the current behavior is a bug, please provide the steps to reproduce.
Here's a repo with the same issue: https://github.com/SebastianBogado/yarn-peer-dependencies
Difference is that it reproduces with
react-redux
and React instead ofjest-styled-components
andstyled-components
What is the expected behavior?
I would expect
yarn
not to install a dev dependency of a dev dependency. And if needed, then it should install the version specified in thepackage.json
.Please mention your node.js, yarn and operating system version.
Yarn: v1.6.0 (--> tried with both v1.7.0 and v1.8.0 and ran into two different issues)
Node: v8.5.0
OS: macOS Sierra v10.12.6
Thanks for your help in advance!
PS:
Workaround
If someone stumbles upon something similar, you can use a postinstall script in your
package.json
. In my case:It's a bit ugly but you can properly arrange any weird nested dependency issue with it.
Might be related to issues: #5705, #5744
The text was updated successfully, but these errors were encountered: