vueuse: Installing the nuxt3 version based on documentation fails due to 'Conflicting peer dependency'

Describe the bug

When Installing the Nuxt3 version based on documentation it fails due to a ‘Conflicting peer dependency’. This happens on a clean npx nuxi init

logs

0 verbose cli [
0 verbose cli   '/Users/***/.nvm/versions/node/v16.13.0/bin/node',
0 verbose cli   '/Users/***/.nvm/versions/node/v16.13.0/bin/npm',
0 verbose cli   'i',
0 verbose cli   '-D',
0 verbose cli   '@vueuse/nuxt',
0 verbose cli   '@vueuse/core'
0 verbose cli ]
1 info using npm@8.5.2
2 info using node@v16.13.0
....
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vue@3.2.31
npm ERR! node_modules/vue
npm ERR!   peer vue@"3.2.31" from @nuxt/vite-builder@3.0.0-27494471.1091d45
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"npm:@nuxt/vite-builder-edge@3.0.0-27494471.1091d45" from nuxt3@3.0.0-27494471.1091d45
npm ERR!     node_modules/nuxt3
npm ERR!       dev nuxt3@"latest" from the root project
npm ERR!   peer vue@"^3.2.25" from @vitejs/plugin-vue@2.3.1
npm ERR!   node_modules/@vitejs/plugin-vue
npm ERR!     @vitejs/plugin-vue@"^2.3.1" from @nuxt/vite-builder@3.0.0-27494471.1091d45
npm ERR!     node_modules/@nuxt/vite-builder
npm ERR!       @nuxt/vite-builder@"npm:@nuxt/vite-builder-edge@3.0.0-27494471.1091d45" from nuxt3@3.0.0-27494471.1091d45
npm ERR!       node_modules/nuxt3
npm ERR!         dev nuxt3@"latest" from the root project
npm ERR!   4 more (@vue/server-renderer, @vueuse/head, nuxt3, vue-router)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @vueuse/core@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue@2.6.14
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 3" from @vue/composition-api@1.4.9
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.0" from @vueuse/core@8.2.5
npm ERR!     node_modules/@vueuse/core
npm ERR!       dev @vueuse/core@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Extra notes and info

  • Installing with yarn works fine
  • upgrading to npm: v8.6.0, still the same issue
  • I have this issue for a long time already and I’ve seen someone else report sort of the same issue https://github.com/vueuse/vueuse/issues/945 and he resolved it with npm install @vueuse/core --legacy-peer-deps which is ok and worked for now i guess… but i am curious what the real problem is and what the fix would be. So i dont have to install this with legacy-peer-deps everytime

Will add more info while debugging node/npm versions

Reproduction

EDIT: The reproduction does not show the actual issue Via stackblitz, I managed to install the packages just fine, therefor i have a feeling its related to npm 8 or my m1 system? https://stackblitz.com/edit/github-xt3wrx-nkwn61?file=package.json

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 142.92 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    npm: 8.5.2 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Edge: 99.0.1150.55
    Safari: 15.3
"devDependencies": {
    "nuxt3": "^3.0.0-27494471.1091d45"
  }


### Used Package Manager

npm

### Validations

- [X] Follow our [Code of Conduct](https://github.com/vueuse/vueuse/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vueuse/vueuse/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vueuse.org/guide).
- [X] Check that there isn't [already an issue](https://github.com/vueuse/vueuse/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vueuse/vueuse/discussions).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 12
  • Comments: 23

Most upvoted comments

Same issue here. Can’t install it with Nuxt 3.

Node v18.1.0 NPM v8.10.0

npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vue@3.2.33
npm ERR! node_modules/vue
npm ERR!   peer vue@"3.2.33" from @nuxt/vite-builder@3.0.0-rc.3
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"^3.0.0-rc.3" from nuxt@3.0.0-rc.3
npm ERR!     node_modules/nuxt
npm ERR!       dev nuxt@"3.0.0-rc.3" from the root project
npm ERR!   peer vue@"^3.2.25" from @vitejs/plugin-vue@2.3.3
npm ERR!   node_modules/@vitejs/plugin-vue
npm ERR!     @vitejs/plugin-vue@"^2.3.2" from @nuxt/vite-builder@3.0.0-rc.3
npm ERR!     node_modules/@nuxt/vite-builder
npm ERR!       @nuxt/vite-builder@"^3.0.0-rc.3" from nuxt@3.0.0-rc.3
npm ERR!       node_modules/nuxt
npm ERR!         dev nuxt@"3.0.0-rc.3" from the root project
npm ERR!   4 more (@vue/server-renderer, @vueuse/head, nuxt, vue-router)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @vueuse/core@"*" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: vue@2.6.14
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 3" from @vue/composition-api@1.6.1
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.0" from @vueuse/core@8.5.0
npm ERR!     node_modules/@vueuse/core
npm ERR!       dev @vueuse/core@"*" from the root project```

The same for me. I tried on a clean project of nuxt v3.0.0-rc1 The complete log:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: ***
npm ERR! Found: @vueuse/core@8.3.0
npm ERR! node_modules/@vueuse/core
npm ERR!   dev @vueuse/core@"^8.3.1" from the root project
npm ERR!   @vueuse/core@"8.3.0" from @vueuse/nuxt@8.3.0
npm ERR!   node_modules/@vueuse/nuxt
npm ERR!     dev @vueuse/nuxt@"^8.3.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @vueuse/core@"^8.3.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: vue@2.6.14
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 3" from @vue/composition-api@1.4.9
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.0" from @vueuse/core@8.3.1
npm ERR!     node_modules/@vueuse/core
npm ERR!       dev @vueuse/core@"^8.3.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/node/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-04-22T10_34_14_261Z-debug-0.log

I only managed to install it by npm i --legacy-peer-deps.

Update 2: I installed an older npm version and now it seems to work

npm install npm@7.0 -g
rm -rf node_modules
npm install

Update 3: Broken again: Created new folder, installed latest NPM again and did a fresh nuxt install etc

nvm install-latest-npm  
npx nuxi init testing
cd testing
npm install
npm i -D @vueuse/nuxt @vueuse/core

same errors

npm ERR! Could not resolve dependency:
npm ERR! dev @vueuse/core@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue@2.6.14

I face the same problem, and after install vue3 all the dependencies will resolved correctly.

If using nuxt3, we still need to install Vue3?

and if you face the problem too, you can

  1. install Vue3 npm install vue
  2. continue with documentation https://vueuse.org/guide/#installation

Current beta (9.0.0-beta.0) is work for me npm i -D @vueuese/core@beta

I’m using node 16 and npm 8. Just praying to not throw any error 😆

npm i @vueuse/core --force

this works!!!

It will work but is not ideal because it will mean any legitimate peer dependency issues are not seen. I believe all of this is a bug in NPM somewhere.