Skip to content

peerDependencies on vue missing for @vueuse/core and @vueuse/shared #2781

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

Closed
7 tasks done
wopian opened this issue Feb 16, 2023 · 17 comments
Closed
7 tasks done

peerDependencies on vue missing for @vueuse/core and @vueuse/shared #2781

wopian opened this issue Feb 16, 2023 · 17 comments

Comments

@wopian
Copy link

wopian commented Feb 16, 2023

Describe the bug

When requesting @vueuse/core with Yarn, it complains about a missing dependency on vue due to using vue-demi:

➤ YN0002: │ @vueuse/core@npm:9.12.0 doesn't provide vue (p0865e), requested by vue-demi
➤ YN0002: │ @vueuse/shared@npm:9.12.0 doesn't provide vue (p9bab8), requested by vue-demi
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code

This is due to the removal of the vue peerDependency and peerDependenciesMeta in this commit: 1b258ac

Reproduction

https://github.com/wopian/vueuse-repro (run yarn after cloning this repo to see above message)

System Info

Binaries:
  Node: 19.6.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 3.4.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm: 8.17.0 - C:\Program Files\nodejs\npm.CMD

Used Package Manager

yarn

Validations

@antfu
Copy link
Member

antfu commented Feb 16, 2023

I am not sure what is happening. From want I understand:

  • VueUse does not directly import vue, while vue-demi has vue as peerDeps
  • You already have vue in your package.json

In which vue is already satisfied. I don't know why yarn emits this error

@wopian
Copy link
Author

wopian commented Feb 17, 2023

Parent packages need to declare the non-optional peer dependencies of packages in their dependencies as peer or optional peer dependencies. It would be optional peer dependencies with */any version for @vueuse/* as they do not import vue

https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency

I.e for each @vueuse/* package that depends on vue-demi, they need these lines (excluding the composition package as its optional in vue-demi): 1b258ac#diff-0b810c38f3c138a3d5e44854edefd5eb966617ca84e62f06511f60acc40546c7L41-L48

@stale
Copy link

stale bot commented Apr 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 18, 2023
@wopian
Copy link
Author

wopian commented Apr 18, 2023

Bump

@stale
Copy link

stale bot commented Jun 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 17, 2023
@wopian
Copy link
Author

wopian commented Jun 17, 2023

Issue still active

@stale stale bot removed the stale label Jun 17, 2023
@l3d00m
Copy link

l3d00m commented Jul 17, 2023

also related to #1912.

@stale
Copy link

stale bot commented Sep 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 16, 2023
@l3d00m
Copy link

l3d00m commented Sep 16, 2023

Not stale

@stale stale bot removed the stale label Sep 16, 2023
@spiltcoffee
Copy link

According to vue-demi's README, plugins/libraries using vue-demi need to also provide the peerDependencies for the versions of vue and @vue/composition-api they want to support:

https://github.com/vueuse/vue-demi#usage
image

That would be the recommended fix for this issue.

Otherwise, for now, users of vueuse can provide packageExtensions in the .yarnrc.yml to address the warning coming from yarn, with something such as the following (which mimics the required fix anyway):

packageExtensions:
  #"@vueuse/<package>@<version>:
  #e.g.:
  "@vueuse/core@10.4.1":
    peerDependencies:
      vue: ^3.0.0-0 || ^2.6.0

Copy link

stale bot commented Nov 24, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 24, 2023
@l3d00m
Copy link

l3d00m commented Nov 24, 2023

Still relevant

@stale stale bot removed the stale label Nov 24, 2023
Copy link

stale bot commented Jan 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 24, 2024
@l3d00m
Copy link

l3d00m commented Jan 24, 2024

Not stale

@stale stale bot removed the stale label Jan 24, 2024
@slangeder
Copy link

I'm using @vueuse/core and I had to fix the missing peerDependencies in multiple @vueuse packages because @vueuse/core depends on @vueuse/shared which also has a dependency to vue-demi.

Here are my changes to .yarnrc.yaml to whom it may concern:

packageExtensions:
  "@vueuse/core@*":
    peerDependencies:
      vue: ^3.0.0-0 || ^2.6.0
  "@vueuse/shared@*":
    peerDependencies:
      vue: ^3.0.0-0 || ^2.6.0

@OrbisK
Copy link
Collaborator

OrbisK commented Dec 23, 2024

@antfu is this still relevant with v12?

@ilyaliao
Copy link
Member

Since vue-demi has been removed in #4349, I think the issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants