npm-check-updates 中的此错误意味着什么?

问题描述 投票:0回答:1

我只是尝试使用 Vue 3、Vuetify 3、Vue-router 和 Pinia 创建一个新项目。我进入了我的所有源代码所在的 c:\Vue 目录,并执行了

npm create vuetify
。结果是这样的:

Vuetify.js - Material Component Framework for Vue

√ Project name: ... vuetify-expense-tracker
√ Which preset would you like to install? » Essentials (Vuetify, VueRouter, Pinia)
√ Use TypeScript? ... No / Yes
√ Would you like to install dependencies with yarn, npm, pnpm, or bun? » npm

◌ Generating scaffold...
◌ Installing dependencies with npm...


added 177 packages, and audited 178 packages in 3m

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

found 0 vulnerabilities

vuetify-expense-tracker has been generated at C:\Vue\vuetify-expense-tracker

Discord community: https://community.vuetifyjs.com
Github: https://github.com/vuetifyjs/vuetify
Support Vuetify: https://github.com/sponsors/johnleider

换句话说,到那时一切都很好。我在 c:ue uetify-expense-tracker 文件夹中打开 VSCode,并在该目录中打开一个终端。我执行了

npm-check-updates
并得到了这个:

PS C:\Vue\vuetify-expense-tracker> npm-check-updates
Checking C:\Vue\vuetify-expense-tracker\package.json
[====================] 14/14 100%

 @mdi/font             7.0.96  →   7.4.47
 @vitejs/plugin-vue    ^4.0.0  →   ^5.0.4
 core-js              ^3.29.0  →  ^3.37.1
 eslint               ^8.37.0  →   ^9.3.0
 eslint-plugin-vue     ^9.3.0  →  ^9.26.0
 pinia                 ^2.0.0  →   ^2.1.7
 sass                 ^1.60.0  →  ^1.77.2
 vite                  ^4.2.0  →  ^5.2.11
 vite-plugin-vuetify   ^1.0.0  →   ^2.0.3
 vue                   ^3.2.0  →  ^3.4.27
 vue-router            ^4.0.0  →   ^4.3.2
 vuetify               ^3.0.0  →   ^3.6.7

Run ncu -u to upgrade package.json

我没有看到任何看起来像错误消息的东西,所以我继续执行

ncu -u
并得到了这个烂摊子:

PS C:\Vue\vuetify-expense-tracker> ncu -u
Upgrading C:\Vue\vuetify-expense-tracker\package.json
[====================] 14/14 100%

 @mdi/font             7.0.96  →   7.4.47
 @vitejs/plugin-vue    ^4.0.0  →   ^5.0.4
 core-js              ^3.29.0  →  ^3.37.1
 eslint               ^8.37.0  →   ^9.3.0
 eslint-plugin-vue     ^9.3.0  →  ^9.26.0
 pinia                 ^2.0.0  →   ^2.1.7
 sass                 ^1.60.0  →  ^1.77.2
 unplugin-fonts        ^1.0.3  →   ^1.1.1
 vite                  ^4.2.0  →  ^5.2.11
 vite-plugin-vuetify   ^1.0.0  →   ^2.0.3
 vue                   ^3.2.0  →  ^3.4.27
 vue-router            ^4.0.0  →   ^4.3.2
 vuetify               ^3.0.0  →   ^3.6.7

Run npm install to install new versions.
PS C:\Vue\vuetify-expense-tracker> npm i
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: @vitejs/[email protected]
npm error node_modules/@vitejs/plugin-vue
npm error   dev @vitejs/plugin-vue@"^5.0.4" from the root project
npm error
npm error Could not resolve dependency:
npm error dev @vitejs/plugin-vue@"^5.0.4" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/vite
npm error   peer vite@"^5.0.0" from @vitejs/[email protected]
npm error   node_modules/@vitejs/plugin-vue
npm error     dev @vitejs/plugin-vue@"^5.0.4" 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 C:\Users\Reinh\AppData\Local\npm-cache\_logs\2024-05-22T15_49_30_507Z-eresolve-report.txt

npm error A complete log of this run can be found in: C:\Users\Reinh\AppData\Local\npm-cache\_logs\2024-05-22T15_49_30_507Z-debug-0.log

这里到底出了什么问题,我该怎么办? Vite 的升级幅度最大。一跳升级这么多vite是不是一个错误?我应该分阶段升级吗?

处理这个问题的正确方法是什么?使用 --force 或 --legacy-peer-deps 听起来像是一个坏主意。在我开始编码之前,我的应用程序似乎就坏了,我真的不知道该怎么办。

npm vuejs3 vite vuetifyjs3
1个回答
0
投票

我并不假装完全理解 npm-check-updates 命令及其各种参数,但我发现对先前问题的回答给了我一个很好的结果:

npm-check-updates (npm ncu):避免破坏更新

具体来说,仅通过

ncu -t minor -u
进行较小的更新(如第一个答案中所述)给了我一个干净的应用程序,没有错误,我现在可以继续开发。

我还不知道未能进行重大更新是否会给我带来进一步的困扰,但这解决了我眼前的问题。

© www.soinside.com 2019 - 2024. All rights reserved.