unplugin / unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup
MIT License
3.21k stars 195 forks source link

ERESOLVE could not resolve #214

Closed mlsjla closed 2 years ago

mlsjla commented 2 years ago
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vue@3.2.37
npm ERR! node_modules/vue
npm ERR!   peer vue@"^2.6.14 || ^3.2.0" from pinia@2.0.14
npm ERR!   node_modules/pinia
npm ERR!     dev pinia@"^2.0.11" from the root project
npm ERR!     peer pinia@">=2.0.14" from @pinia/nuxt@0.1.9
npm ERR!     node_modules/@pinia/nuxt
npm ERR!       dev @pinia/nuxt@"^0.1.8" from the root project
npm ERR!     1 more (pinia-plugin-persistedstate)
npm ERR!   peer vue@"^3.2.0" from element-plus@2.2.6
npm ERR!   node_modules/element-plus
npm ERR!     dev element-plus@"^2.2.6" from the root project
npm ERR!   2 more (naive-ui, nuxt)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev unplugin-auto-import@"^0.9.2" 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.3
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.0" from @vueuse/core@8.7.5
npm ERR!     node_modules/@vueuse/core
npm ERR!       peerOptional @vueuse/core@"*" from unplugin-auto-import@0.9.2
npm ERR!       node_modules/unplugin-auto-import
npm ERR!         dev unplugin-auto-import@"^0.9.2" 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/mac/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mac/.npm/_logs/2022-06-29T14_02_03_416Z-debug-0.log

 ERROR  Command failed: npm install                                               22:02:09

  at checkExecSyncError (node:child_process:817:11)
  at execSync (node:child_process:888:15)
  at Object.invoke (node_modules/nuxi/dist/chunks/upgrade.mjs:49:7)
  at async _main (node_modules/nuxi/dist/cli.mjs:46:20)
antfu commented 2 years ago

We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.

Why reproduction is required

victor-duarte commented 2 years ago

Not sure if this will help others:

I got a similar error when installing unplugin-auto-import after already had installed other packages:

npx nuxi init nuxt-app
cd nuxt-app
npm i
npm i -D unplugin-auto-import

output:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vue@3.2.37
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.2.37" from @nuxt/vite-builder@3.0.0-rc.4
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"^3.0.0-rc.4" from nuxt@3.0.0-rc.4
npm ERR!     node_modules/nuxt
npm ERR!       dev nuxt@"3.0.0-rc.4" 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.3" from @nuxt/vite-builder@3.0.0-rc.4
npm ERR!     node_modules/@nuxt/vite-builder
npm ERR!       @nuxt/vite-builder@"^3.0.0-rc.4" from nuxt@3.0.0-rc.4
npm ERR!       node_modules/nuxt
npm ERR!         dev nuxt@"3.0.0-rc.4" 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 unplugin-auto-import@"*" 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.3
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.0" from @vueuse/core@8.7.5
npm ERR!     node_modules/@vueuse/core
npm ERR!       peerOptional @vueuse/core@"*" from unplugin-auto-import@0.9.2
npm ERR!       node_modules/unplugin-auto-import
npm ERR!         dev unplugin-auto-import@"*" from the root project

*I don't see the error if I run install like so:

npx nuxi init nuxt-app
cd nuxt-app
npm i -D unplugin-auto-import

output:

npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility

added 614 packages, and audited 615 packages in 7s

81 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Node: v16.15.1 NPM: 8.11.0

In my project I got conflicts with other packages, could be we have not configured dependencies correctly (in case I get more info on this will share). We are trying to test composables with autoimports (vitest)

"@nuxt/test-utils-edge": "^3.0.0-rc.4-27588443.cf25525",
"@testing-library/vue": "^6.6.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.37
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.2.37" from @nuxt/test-utils-edge@3.0.0-rc.4-27609974.fe508f5
npm ERR!   node_modules/@nuxt/test-utils-edge
npm ERR!     dev @nuxt/test-utils-edge@"^3.0.0-rc.4-27588443.cf25525" from the root project
npm ERR!   peer vue@">= 3" from @testing-library/vue@6.6.0
npm ERR!   node_modules/@testing-library/vue
npm ERR!     dev @testing-library/vue@"^6.6.0" from the root project
npm ERR!   1 more (nuxt)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev unplugin-auto-import@"^0.9.2" 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.3
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.1.0" from @vueuse/core@8.7.5
npm ERR!     node_modules/@vueuse/core
npm ERR!       peerOptional @vueuse/core@"*" from unplugin-auto-import@0.9.2
npm ERR!       node_modules/unplugin-auto-import
npm ERR!         dev unplugin-auto-import@"^0.9.2" 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.