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

Unable to install vue-query for nuxt 3 #5115

Closed
dextersiah opened this issue Mar 11, 2023 · 5 comments
Closed

Unable to install vue-query for nuxt 3 #5115

dextersiah opened this issue Mar 11, 2023 · 5 comments

Comments

@dextersiah
Copy link

Describe the bug

Hi folks, I am trying to experiment vue-query with Nuxt3 however when I'm trying to install the package via npm. I got an error regarding conflicting peer dependency.

However it seems to be installing right in the stackblitz environment.

image

Your minimal, reproducible example

https://stackblitz.com/edit/nuxt-starter-vgim69?file=package.json

Steps to reproduce

  1. Create a new Nuxt3 project with npx nuxi@latest init my-app
  2. Install vue-query npm i @tanstack/vue-query
  3. Error installing package

Expected behavior

There shouldn't be a dependency peer issue as I'm installing the latest Nuxt3 Version

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

  • Operation System: Windows 11
  • Node Version :v16.14.0
  • NPM Version: 8.3.1
  • Nuxt: ^3.2.3

Tanstack Query adapter

None

TanStack Query version

^4.26.1

TypeScript version

No response

Additional context

No response

@ctholho
Copy link

ctholho commented Mar 13, 2023

This is a problem on your end. E.g. try to clean the npm cache (e.g. npm cache clean --force) and make sure you're not accidentally in a directory with a package.json that has vue 2.6 as dependency.

@dextersiah
Copy link
Author

Indeed it seems like a cache issue. Fixed with the cache clean command. thanks @ctholho. Mark as answered

@kendallroth
Copy link

I am running into the same issue, with a fresh install of Nuxt 3. Cleaning the cache unfortunately did not resolve the issue, and I have verified that Vue 2.6 is not required anywhere.

❯ npm install @tanstack/vue-query
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: nuxt-app@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.2.47" from @nuxt/[email protected]
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"3.3.2" from [email protected]
npm ERR!     node_modules/nuxt
npm ERR!       dev nuxt@"^3.3.2" from the root project
npm ERR!   peer vue@">=2.7 || >=3" from @unhead/[email protected]
npm ERR!   node_modules/@unhead/vue
npm ERR!     @unhead/vue@"^1.1.23" from [email protected]
npm ERR!     node_modules/nuxt
npm ERR!       dev nuxt@"^3.3.2" from the root project
npm ERR!   8 more (@vitejs/plugin-vue, @vitejs/plugin-vue-jsx, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! @tanstack/vue-query@"*" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 2.7" from @vue/[email protected]
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.2" from @tanstack/[email protected]
npm ERR!     node_modules/@tanstack/vue-query
npm ERR!       @tanstack/vue-query@"*" from the root project

@pastinepolenta
Copy link

pastinepolenta commented Apr 13, 2023

Recent NPM version install peer dependencies by default. @tanstack/vue-query has a peer dependency @vue/composition-api@"^1.1.2" which in turn has a peer dependency vue@">= 2.5 < 2.7" which does not match with the goal of using Vue 3 instead of 2.

Is the peer dependencies config of those packages correct ? Or am I missing something?
EDIT: I had an issue on my registry ignoring the optional part of @vue/composition-api and so creating a conflict

@ctholho
Copy link

ctholho commented Apr 13, 2023

Edit: ninja'd by your edit. 👍
@pastinepolenta @vue/composition-api is marked as optional

"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true

Optional peer dependencies shouldn't be installed: See npm/rfcs#221

The repro stackblitz of OP doesn't have the problem you're describing.

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

4 participants