Nuxt 和 vuex-persist:npm 错误!代码 ERESOLVE

发布于 2025-01-10 12:25:12 字数 2713 浏览 0 评论 0原文

安装 npm install --save vuex-persist 后使用 npm up 时出现以下错误,这个包和我的配置有什么问题?

我正在使用 Nuxt ^2.15.8

❯ npm up
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"*" from @nuxtjs/[email protected]
npm ERR!   node_modules/@nuxtjs/auth-next
npm ERR!     @nuxtjs/auth-next@"5.0.0-1643791578.532b3d6" from the root project
npm ERR!   peer vue@"^2.6.4" from [email protected]
npm ERR!   node_modules/vuetify
npm ERR!     vuetify@"^2.6.3" from the root project
npm ERR!     vuetify@"^2.6" from @nuxtjs/[email protected]
npm ERR!     node_modules/@nuxtjs/vuetify
npm ERR!       dev @nuxtjs/vuetify@"^1.12.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! vuex-persist@"^3.1.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.0.2" from [email protected]
npm ERR!   node_modules/vuex
npm ERR!     peer vuex@">=2.5" from [email protected]
npm ERR!     node_modules/vuex-persist
npm ERR!       vuex-persist@"^3.1.3" 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/me/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2022-02-28T11_06_47_549Z-debug-0.log

这个问题可以这样重现:

npm init nuxt-app foo
cd foo
npm install --save vuex-persist
npm up

I'm getting the following error when using npm up after installing npm install --save vuex-persist, what's wrong with this package and my configuration?

I'm using Nuxt ^2.15.8.

❯ npm up
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"*" from @nuxtjs/[email protected]
npm ERR!   node_modules/@nuxtjs/auth-next
npm ERR!     @nuxtjs/auth-next@"5.0.0-1643791578.532b3d6" from the root project
npm ERR!   peer vue@"^2.6.4" from [email protected]
npm ERR!   node_modules/vuetify
npm ERR!     vuetify@"^2.6.3" from the root project
npm ERR!     vuetify@"^2.6" from @nuxtjs/[email protected]
npm ERR!     node_modules/@nuxtjs/vuetify
npm ERR!       dev @nuxtjs/vuetify@"^1.12.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! vuex-persist@"^3.1.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"^3.0.2" from [email protected]
npm ERR!   node_modules/vuex
npm ERR!     peer vuex@">=2.5" from [email protected]
npm ERR!     node_modules/vuex-persist
npm ERR!       vuex-persist@"^3.1.3" 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/me/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2022-02-28T11_06_47_549Z-debug-0.log

This issue can be reproducted this way:

npm init nuxt-app foo
cd foo
npm install --save vuex-persist
npm up

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

善良天后 2025-01-17 12:25:12

我最终通过在 package.json 中设置 "vuex": "<4" 修复了它:

  "dependencies": {
    ...,
    "vuex": "<4"
  }

I finally fixed it by setting "vuex": "<4" in my package.json:

  "dependencies": {
    ...,
    "vuex": "<4"
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文