vue3+vite installation element-plus error report solution - using components does not work

11f7aa3aa2e95380029fec3240d3d522.png

Preface

Install in the project you just started usingvue3+vite+ , using the component does not work, the error is as follows:tselement-plus

UnCaugh SyntaxError:The requested module '/node_modules/element-plus/lib/locale/lang/zh-cn.js?v=7.0.2' does not provide an export named 'default'

solution

  • Removalnode_modulesRemoval of textpackage-lock.jsonRemoval of text

  • Revisepackage.json

  • Revised VueVersion, issue required 3.3.2or more

  • Installelement-plus, re-npm install i --force, force installation, otherwise an error will be reported

element-plus cannot find style

Inmain.js, find the imported element-plus style

The solution is also very simple. Since you have installedelement-plus the dependency but cannot find the file, it is most likely that the path has changed. So I flipped through it manuallynode-modules and found that the entiretheme-chalk folder had been moved

Old version installation location

import 'element-plus/lib/theme-chalk/index.css';   // 这里巨坑,路径问题

New version installation location

import 'element-plus/dist/index.css';

If a style problem is found, it is most likely a problem with the location where the style is introduced.

Summarize

element-plusThe use is not much different fromElementUI, but there are some pitfalls that need to be avoided

Front-end and back-end development interface joint debugging and docking parameters

2023-09-13

d89381231b3d04ca63952fce64dae7d0.jpeg

Fill out questionnaires and earn bonuses

2023-09-12

3f1d45d7809648cb71c7315ede212065.jpeg

Implementing 3D panoramic room viewing in Vue

2023-09-11

137f38501de242ae54777449c4d1fdf0.jpeg

The old lady, aunt and harvester scholar were banned

2023-09-10

b001b64847b6d8d282ff9e9059c59885.jpeg

Let’s talk about sauce latte, Ruixing and Moutai join forces

2023-09-09

a289d6e9b30b3628b597a9c88c963399.jpeg

Implement automatic rotation of 3D ball in Vue

2023-09-08

e7de729c602f1e0df359d10754fa3198.jpeg

How to implement a 3D city distribution map in Vue

2023-09-07

ee230c9075d6f3d8e4f27e8f2f669c4a.jpeg

2a0b8665d3e61309ddfc64f40c6782eb.png

(Able to draw and answer questions)

ffe2c6e6ee6beb5857c838df60272aa9.png

Guess you like

Origin blog.csdn.net/wzc_coder/article/details/133003824