Solution to the failure of vue installation of Element

A few days ago, I wrote the background management need to be hungry-Element, but the installation always failed, and later found a solution, you can refer to it

The foreplay is straightforward, let's talk about the key
solution:
start the small blueprint (little black notebook) under the project path to install element-ui, and run the command.

cnpm install element-ui -s

ok, if the installation is successful at this time, we come to the next step

Run command

cnpm install

Introduce Element-ui

/* 引入element */
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

/* 使用ElementUI */
Vue.use(ElementUI)
Vue.config.productionTip = false

Then introduce the element template

Startup project

cnpm  run dev    

or

npm start

Started successfully and completed.

If you get the following error:
Insert picture description here
Missing components, install the components in the directory of this project

I have installed it before, but this installation is carried out under the directory of the c drive administrator

1. Use the cmd command to switch to the project directory

2. cnpm i element-ui -S If you don't use Taobao mirror, use npm i element-ui -S command

Guess you like

Origin blog.csdn.net/qq_44977477/article/details/102984210