Vue installation element component error

use the element installed by cnpm I element-ui s to install the

introduced in the portal file.
import ElementUI from "element-ui"
import "element-ui/lib/theme-default/index.css"

but misreported

This dependency was not found:

* element-ui/lib/theme-default/index.css in ./src/main.js

To install it, you can run: npm install --save element-ui/lib/theme-default/inde
x.css

then I executed `cnpm install-- save element-ui/lib/theme-default/inde
x.css` according to the prompt given by it, but reported it incorrectly. What happened?

F:\VUE\blog>cnpm install --save element-ui/lib/theme-default/index.css
 Install fail! Error: [@element-ui/lib/theme-default/index.css] resolved targe
t F:\VUE\blog\element-ui\lib\theme-default\index.css error: ENOENT: no such file
 or directory, lstat "F:\VUE\blog\element-ui"
Error: [@element-ui/lib/theme-default/index.css] resolved target F:\VUE\blog\ele
ment-ui\lib\theme-default\index.css error: ENOENT: no such file or directory, ls
tat "F:\VUE\blog\element-ui"
    at module.exports (C:\Users\aaa\AppData\Roaming\npm\node_modules\cnpm\node_m
odules\npminstall\lib\download\local.js:30:11)
    at module.exports.throw (<anonymous>)
    at onRejected (C:\Users\aaa\AppData\Roaming\npm\node_modules\cnpm\node_modul
es\co\index.js:81:24)
    at <anonymous>
npminstall version: 3.12.0
npminstall args: C:\Program Files\nodejs\node.exe C:\Users\aaa\AppData\Roaming\n
pm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions -
-china --userconfig=C:\Users\aaa\.cnpmrc --disturl=https://npm.taobao.org/mirror
s/node --registry=https://registry.npm.taobao.org --save element-ui/lib/theme-de
fault/index.css
Sep.03,2021

its style file does not need to be installed by npm. It should be the wrong path for the introduction of import 'element-ui/lib/theme-default/index.css'. Please check it again.


import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';

Vue.use(ElementUI);

new Vue({
  el: '-sharpapp',
  render: h => h(App)
});

in the official document , css is in theme-chalk . Under the dependencies you need to install, it is in that directory
clipboard.png

.

to find the template element-ui in node_moudules, look at the path of the actual index.css

Menu