我是靠谱客的博主 害羞茉莉,这篇文章主要介绍vue3安装element-ui失败报错项目场景:问题描述原因分析:解决方案:,现在分享给大家,希望可以做个参考。

项目场景:

前端vue3项目需要安装element-ui


问题描述

npm安装element-ui报错

复制代码
1
2
npm i element-ui -S

报错

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
D:javascriptfund-managementprojectsnode-demonode-vue-ele-appclient>npm i element-ui -S npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: client@0.1.0 npm ERR! Found: vue@3.2.32 npm ERR! node_modules/vue npm ERR! vue@"^3.2.13" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@"^2.5.17" from element-ui@2.15.8 npm ERR! node_modules/element-ui npm ERR! element-ui@"*" 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 C:UsersThinkPadAppDataLocalnpm-cacheeresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:UsersThinkPadAppDataLocalnpm-cache_logs2022-04-14T03_03_41_897Z-debug-0.log

原因分析:

element-plus不适配vue3,官方已将vue3版本的更新为element-plus
在这里插入图片描述
链接: element-plus说明文档.


解决方案:

安装

复制代码
1
2
npm install element-plus --save

引入

复制代码
1
2
3
4
5
6
7
8
9
10
import { createApp } from 'vue' import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import App from './App.vue' const app = createApp(App) app.use(ElementPlus) app.mount('#app')

最后

以上就是害羞茉莉最近收集整理的关于vue3安装element-ui失败报错项目场景:问题描述原因分析:解决方案:的全部内容,更多相关vue3安装element-ui失败报错项目场景内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部