Nuxt3 / vue-datocms issue

There seems to be a dependency issue when installing vue-datocms with the new stable version of Nuxt3.

I ran (node 16.16)

npx nuxi init dato-test 
cd dato-test
npm i
// runs fine 
npm i vue-datocms

The install fails with the following error

❯ npm i vue-datocms
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vue@3.2.45
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.2.45" from @nuxt/vite-builder@3.0.0
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"3.0.0" from nuxt@3.0.0
npm ERR!     node_modules/nuxt
npm ERR!       dev nuxt@"3.0.0" from the root project
npm ERR!   peer vue@">=2.7 || >=3" from @unhead/vue@1.0.4
npm ERR!   node_modules/@unhead/vue
npm ERR!     @unhead/vue@"^1.0.4" from @vueuse/head@1.0.18
npm ERR!     node_modules/@vueuse/head
npm ERR!       @vueuse/head@"^1.0.15" from nuxt@3.0.0
npm ERR!       node_modules/nuxt
npm ERR!         dev nuxt@"3.0.0" from the root project
npm ERR!   6 more (@vitejs/plugin-vue, @vitejs/plugin-vue-jsx, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! vue-datocms@"*" 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 < 2.7" from @vue/composition-api@1.7.1
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.7.1" from vue-datocms@4.0.1
npm ERR!     node_modules/vue-datocms
npm ERR!       vue-datocms@"*" 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 /Users/timchesney/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/timchesney/.npm/_logs/2022-11-24T18_37_05_496Z-debug-0.log

npm i vue-datocms --force solves the issue and everything runs fine… but seems like there is potentially a dependency issue there.

Hi @tim1,

That looks indeed like a dependency issue, even if an optional peer dependency is involved.

Your solution using --force option works.

The cleanest solution I found at the moment, is to install Vue before vue-datocms:

 npx nuxi init dato-test
 cd dato-test/
 npm i
 npm install vue
 npm install vue-datocms

I suppose that by doing that, the dependency tree for optional peers changes
a bit, resulting in no errors during installation.

Silvano

The above solution used to work but since the latest updates it’s not working anymore.

Would be awesome to have it solved directly in the vue-datocms repo.