我正在继承一个项目,它是建立在Vue 2上的,我相信问题是我的系统上安装了Vue 3(我在macOS上)。
Vue是个新手,所以如果答案很明显,我很抱歉。
我的package.json。您可以在这里看到我的vue版本是2.6.10,我相信错误是说我已经在我的主机系统上安装了3.0,可能是全局安装的。我不知道如何绕过这一点,我需要Vue 3安装在我的系统上为另一个项目,我相信这是什么是冲突的。
{
"name": "test-vuetify",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"@fontsource/roboto": "^4.5.7",
"axios": "^0.21.4",
"core-js": "^2.6.5",
"plotly.js": "^1.52.2",
"plotly.js-cartesian-dist-min": "^1.54.5",
"sinon": "^8.1.1",
"socket.io-client": "^4.4.1",
"vue": "^2.6.10",
"vue-class-component": "^7.0.2",
"vue-json-csv": "^1.2.12",
"vue-moment": "^4.1.0",
"vue-property-decorator": "^8.1.0",
"vue-router": "^3.0.3",
"vue-toast-notification": "^3.0.0",
"vue-toasted": "^1.1.28",
"vuetify": "^2.4.4",
"vuex": "^3.0.1"
},
"devDependencies": {
"@mdi/font": "^4.2.95",
"@types/jest": "^24.0.19",
"@vue/cli-plugin-babel": "^3.11.0",
"@vue/cli-plugin-typescript": "^3.11.0",
"@vue/cli-plugin-unit-jest": "^4.2.2",
"@vue/cli-service": "^3.11.0",
"@vue/test-utils": "1.0.0-beta.31",
"canvas": "^2.9.0",
"jest-canvas-mock": "^2.2.0",
"sass": "^1.18.0",
"sass-loader": "^7.1.0",
"typescript": "^3.4.3",
"vue-cli-plugin-vuetify": "^0.6.3",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.2.2"
}
}
当我安装npm时的错误..。
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: vue-toast-notification@3.0.0
npm ERR! Found: vue@2.6.14
npm ERR! node_modules/vue
npm ERR! vue@"^2.6.10" from the root project
npm ERR! peer vue@"2.x" from @vue/test-utils@1.0.0-beta.31
npm ERR! node_modules/@vue/test-utils
npm ERR! dev @vue/test-utils@"1.0.0-beta.31" from the root project
npm ERR! 7 more (vue-class-component, vue-jest, vue-json-csv, vue-moment, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.0" from vue-toast-notification@3.0.0
npm ERR! node_modules/vue-toast-notification
npm ERR! vue-toast-notification@"^3.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue@3.2.37
npm ERR! node_modules/vue
npm ERR! peer vue@"^3.0" from vue-toast-notification@3.0.0
npm ERR! node_modules/vue-toast-notification
npm ERR! vue-toast-notification@"^3.0.0" 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.
发布于 2022-06-20 20:50:06
此错误源位于vue-toast-notification@3.0.0
中。
npm ERR! While resolving: vue-toast-notification@3.0.0
提到的问题是:
npm ERR! Found: vue@2.6.14
…
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.0" from vue-toast-notification@3.0.0
这个错误意味着库vue-toast-notification@3.0.0
需要版本3中的Vue才能正确工作(这里提到版本是对等依赖的,我也在他们的文档页上确认了这一点)。换句话说,您在项目中使用的是一个不兼容的库。您有Vue@2项目,其中您安装了一个专门用于Vue@3项目的依赖包。要解决这个问题,您需要将vue-toast-notification
作为一个依赖项来安装,其版本专用于vue@2。在本例中,它应该是vue-toast-notification@^0.6
。
发布于 2022-09-29 18:38:11
https://stackoverflow.com/questions/72692138
复制相似问题