cant install @tanstack/vue-query?

npm i @tanstack/vue-query :snowflake: shell
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: nuxt-app@undefined
npm error Found: [email protected]
npm error node_modules/vue
npm error peer vue@">=3" from @iconify/[email protected]
npm error node_modules/@iconify/vue
npm error @iconify/vue@"^4.2.0" from @nuxt/[email protected]
npm error node_modules/@nuxt/icon
npm error @nuxt/icon@"^1.10.3" from the root project
npm error peer vue@"^3.3.4" from @nuxt/[email protected]
npm error node_modules/@nuxt/vite-builder
npm error @nuxt/vite-builder@"3.15.4" from [email protected]
npm error node_modules/nuxt
npm error nuxt@"^3.15.4" from the root project
npm error 14 more (@radix-icons/vue, @tanstack/vue-virtual, @unhead/vue, ...)
npm error
npm error Could not resolve dependency:
npm error @tanstack/vue-query@"*" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/vue
npm error peer vue@">= 2.5 < 2.7" from @vue/[email protected]
npm error node_modules/@vue/composition-api
npm error peerOptional @vue/composition-api@"^1.1.2" from @tanstack/[email protected]
npm error node_modules/@tanstack/vue-query
npm error @tanstack/vue-query@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/bea/.npm/_logs/2025-02-13T23_49_48_949Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/bea/.npm/_logs/2025-02-13T23_49_48_949Z-debug-0.log
npm i @tanstack/vue-query :snowflake: shell
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: nuxt-app@undefined
npm error Found: [email protected]
npm error node_modules/vue
npm error peer vue@">=3" from @iconify/[email protected]
npm error node_modules/@iconify/vue
npm error @iconify/vue@"^4.2.0" from @nuxt/[email protected]
npm error node_modules/@nuxt/icon
npm error @nuxt/icon@"^1.10.3" from the root project
npm error peer vue@"^3.3.4" from @nuxt/[email protected]
npm error node_modules/@nuxt/vite-builder
npm error @nuxt/vite-builder@"3.15.4" from [email protected]
npm error node_modules/nuxt
npm error nuxt@"^3.15.4" from the root project
npm error 14 more (@radix-icons/vue, @tanstack/vue-virtual, @unhead/vue, ...)
npm error
npm error Could not resolve dependency:
npm error @tanstack/vue-query@"*" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/vue
npm error peer vue@">= 2.5 < 2.7" from @vue/[email protected]
npm error node_modules/@vue/composition-api
npm error peerOptional @vue/composition-api@"^1.1.2" from @tanstack/[email protected]
npm error node_modules/@tanstack/vue-query
npm error @tanstack/vue-query@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/bea/.npm/_logs/2025-02-13T23_49_48_949Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/bea/.npm/_logs/2025-02-13T23_49_48_949Z-debug-0.log
first time i got a dependency error, can i just ignore it? i think tanstack query uses a outdated version of composition api or something..
10 Replies
kapa.ai
kapa.ai2w ago
Hi @neargore. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the error message you've provided, it appears you're encountering a dependency conflict when trying to install @tanstack/vue-query in a Nuxt 3 project. This conflict is occurring because @tanstack/vue-query has a peer dependency on an older version of Vue (Vue 2) and the @vue/composition-api, which are not compatible with your Nuxt 3 project that uses Vue 3. You should not ignore this error, as it indicates a fundamental incompatibility that could lead to issues in your project. Instead, I recommend the following steps: 1. Check for a newer version of @tanstack/vue-query that supports Vue 3 and Nuxt 3. The latest versions should be compatible. 2. If you're sure you want to use the latest version, you can try installing it with the --force flag, but this is not recommended as it might lead to unexpected behavior:
npm i @tanstack/vue-query --force

npm i @tanstack/vue-query --force

3. Alternatively, you could consider using @tanstack/vue-query with Nuxt Bridge if you're migrating from Nuxt 2 to Nuxt 3. However, based on your error message, it seems you're already using Nuxt 3, so this option is not applicable in your case. 4. If you're starting a new Nuxt 3 project, make sure you're using the latest versions of Nuxt and its dependencies. You can create a fresh Nuxt 3 project using the nuxi command-line tool, which should set up the correct dependencies for you. For the most up-to-date information on compatibility and installation instructions, I recommend checking the official documentation for @tanstack/vue-query and ensuring you're using a version that's compatible with Vue 3 and Nuxt 3. Remember, it's crucial to maintain consistent and compatible versions of your dependencies to ensure your project functions correctly. Nuxt 3 Documentation provides more information on setting up and managing dependencies in Nuxt 3 projects. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@1331083366279417886> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
meowcat_32
meowcat_32OP2w ago
vue query has listed in their dependencies :
"peerDependencies": {
"@vue/composition-api": "^1.1.2",
"vue": "^2.6.0 || ^3.3.0"
}
"peerDependencies": {
"@vue/composition-api": "^1.1.2",
"vue": "^2.6.0 || ^3.3.0"
}
why am i still getting the dependency error then? @kapa.ai
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: Sorry @neargore, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
meowcat_32
meowcat_32OP2w ago
@kapa.ai vue query has listed in their dependencies : "peerDependencies": { "@vue/composition-api": "^1.1.2", "vue": "^2.6.0 || ^3.3.0" } why am i still getting the dependency error then?
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the peer dependencies you've listed for Vue Query, it appears that the package should be compatible with both Vue 2 and Vue 3. However, you're still encountering a dependency error. Let's analyze this situation: 1. The error message you provided earlier indicates that your project is using Vue 3.5.13, which should be compatible with the Vue Query requirement of "vue": "^2.6.0 || ^3.3.0". 2. The issue seems to be arising from the "@vue/composition-api" peer dependency. In a Vue 3 project (which Nuxt 3 uses), you don't need the separate "@vue/composition-api" package, as it's built into Vue 3. 3. The error message suggests that npm is trying to resolve this peer dependency, even though it's not needed for Vue 3. This situation is likely occurring due to how npm handles peer dependencies. Here are a few potential solutions: 1. Use --legacy-peer-deps flag: This tells npm to ignore peer dependency conflicts and install the package anyway. However, use this with caution as it might lead to unexpected behavior.
npm i @tanstack/vue-query --legacy-peer-deps

npm i @tanstack/vue-query --legacy-peer-deps

2. Use pnpm or yarn: These package managers often handle peer dependencies better than npm. If possible, consider switching to one of these for your project. 3. Check for a more recent version of @tanstack/vue-query: The maintainers might have updated the peer dependencies to better handle Vue 3 projects without requiring @vue/composition-api. 4. Create a pnpm-workspace.yaml file: If you're using pnpm, you can create this file to specify which packages to use, potentially resolving the conflict. 5. Use Nuxt's built-in composables: Nuxt 3 provides its own composables for data fetching, which might be an alternative to using Vue Query in some cases. For the most up-to-date and accurate information on resolving this issue, I recommend checking the Nuxt 3 documentation and the @tanstack/vue-query GitHub repository for any known issues or workarounds specific to Nuxt 3 integration. Remember, forcing installation or ignoring peer dependencies can lead to subtle bugs, so it's always best to ensure all your dependencies are truly compatible before proceeding. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@1331083366279417886> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
meowcat_32
meowcat_32OP2w ago
dumb ai
manniL
manniL2w ago
@neargore try it using PNPM or similar NPM and peer deps act weird often sadly (you can also use the flag mentioend by Kapa/The error)
Mittchel
Mittchel2w ago
use bun

Did you find this page helpful?