Skip to content
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

Unmet peer dependency warnings for @storybook/addon-storyshots@6.2.9 when running yarn install #14758

Closed
alinalobast opened this issue Apr 29, 2021 · 13 comments
Labels
question / support yarn / npm Yarn / npm acting weird

Comments

@alinalobast
Copy link

When running yarn install we are getting unmet peer dependency warnings:

 warning "workspace-aggregator-... > ... > @storybook/addon-storyshots@6.2.9" has unmet peer dependency "svelte@*".
 warning "workspace-aggregator-... > ... > @storybook/addon-storyshots@6.2.9" has unmet peer dependency "vue-jest@*".
 warning "workspace-aggregator-... > ... > @storybook/addon-storyshots > react-test-renderer@17.0.2" has incorrect peer dependency "react@17.0.2".

We are using the following devDependencies in our repo:

        "storybook": "^6.2.8",
        "@storybook/addon-a11y": "^6.2.8",
        "@storybook/addon-essentials": "^6.2.8",
        "@storybook/addon-jest": "^6.2.8",
        "@storybook/addon-links": "^6.2.8",
        "@storybook/addon-storyshots": "^6.2.8",
        "@storybook/react": "^6.2.8"

as well as dependencies:

        "react": "^16.13.1",
        "react-dom": "^16.13.1"

and also added "react-test-renderer": "^16.13.1" to try resolve one of the warnings, which did not help.
Also, it is weird that it still asks forreact-test-renderer@17.0.2" and "react@17.0.2", while "react-test-renderer": "^16.13.1" and "react": "^16.13.1" have been clearly met.

Surely, the option is to add all the above as devDependencies of out package.json, but I do not think it's a viable option. There are similar issues that were discussed in yarn community yarnpkg/yarn#5347

Would appreciate your advice on this, thanks!

@shilman
Copy link
Member

shilman commented Apr 29, 2021

@merceyz any chance you can weigh in on this one?

@darekkay
Copy link

darekkay commented May 1, 2021

Also, it is weird that it still asks for react-test-renderer@17.0.2" and "react@17.0.2", while "react-test-renderer": "^16.13.1" and "react": "^16.13.1" have been clearly met.

The caret notation ^16.13.1 will only match minor versions 16.x.x, so it does not fulfill the required "react@17.0.2" peer dependency. You would need to update your react dependency version to ^17.0.0.

If you indeed have React 16.x installed and storyshots works without any issues, then the question is whether it makes sense to lower React's peer dependency version in storyshots instead.

@shilman
Copy link
Member

shilman commented May 2, 2021

You could fix this by installing an earlier version of react-test-renderer. Storyshots has a dependency on:

     "react-test-renderer": "^16.8.0 || ^17.0.0",

So yarn installs the most recent version. But you could force it to use an earlier version that is compatible with your version of React.

@alinalobast
Copy link
Author

Thank you all for replying!

You would need to update your react dependency version to ^17.0.0.

This is not an option for us, unfortunately, due to the usage of our package and reliance on something else that still has React v16. We tried migrating to v17 at some point, but this resulted in version conflicts.

You could fix this by installing an earlier version of react-test-renderer.

I just tried to change "react-test-renderer" to ^16.8.0, but I am still getting the following warnings:

@storybook/addon-storyshots@6.2.9" has unmet peer dependency "vue-jest@*".
@storybook/addon-storyshots > react-test-renderer@17.0.2" has incorrect peer dependency "react@17.0.2".

@merceyz
Copy link
Contributor

merceyz commented May 6, 2021

@merceyz any chance you can weigh in on this one?

@shilman - #14758 (comment)

Sure, I opened #14835 to deal with the dependencies that Storybook controls, not much can be done about the range specified by react-test-renderer here.

@shilman
Copy link
Member

shilman commented May 7, 2021

ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.21 containing PR #14835 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed May 7, 2021
@alinalobast
Copy link
Author

Thank you @shilman! I tried to install Storybook and Storyshots addons v6.3.0-alpha.21 and I am getting these 2 warnings:

@storybook/addon-storyshots > react-test-renderer@17.0.2" has incorrect peer dependency "react@17.0.2".
@storybook/addon-storyshots > preact-render-to-string@5.1.19" has unmet peer dependency "preact@>=10".

As per the conversation above, there's not much that can be done about the first one, but the second one is a new warning that started to appear... Does it mean we now need to install preact as a devDependency too? Is there a way to avoid this?

@shilman
Copy link
Member

shilman commented May 14, 2021

Man ... they just don't stop do they?!! PRs welcome! 🙏

@merceyz
Copy link
Contributor

merceyz commented May 14, 2021

That one is already specified correctly, seems Yarn 1.x isn't able to detect it. Yarn 2+ handles it correctly

@darekkay
Copy link

darekkay commented May 14, 2021

That one is already specified correctly

Is it? It isn't specified in Storyshot's package.json. See my PR: #14932

@merceyz
Copy link
Contributor

merceyz commented May 14, 2021

Yes, it's a normal dependency which has a peer dependency on preact which @storybook/addon-storyshots declares as an optional peer dependency

"preact-render-to-string": "^5.1.19",


"preact": {
"optional": true
},

@darekkay
Copy link

Thanks for the explanation, this makes sense. Do you know if npm7 handles this use case this way, too?

If yarn 1 isn't handling it correctly (and it's probably not going to be fixed within yarn itself), my change could still be merged to prevent the warning, right?

@merceyz
Copy link
Contributor

merceyz commented May 14, 2021

Do you know if npm7 handles this use case this way, too?

I tested npm@7.13.0 and it doesn't even install preact-render-to-string

npm install @storybook/addon-storyshots@6.3.0-alpha.21
ls -R node_modules/ | grep preact-render-to-string

cc @isaacs

my change could still be merged to prevent the warning, right?

preact-render-to-string isn't a peer dependency so it wouldn't help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question / support yarn / npm Yarn / npm acting weird
Projects
None yet
Development

No branches or pull requests

4 participants