前言:我的node是默认安装的,路径为C:\Program Files\nodejs,这里怎么安装配置环境变量我就不说了,我要演示的是在桌面的一个文件夹里创建,路径为C:\Users\18168\Desktop\vue。
1。使用vue ui创建页面时,创建页面有个进度条一直加载闪烁。
原因:在桌面直接以管理员启动了cmd,然后输入了vue ui。
注意:我在其他博客上看到了解决办法是,不用管理员启动,进度条的确不闪烁了,但这会导致创建vue的router项目时,会退回到创建项目时的最后一个页面,也就是配置页面。然后继续点击“创建项目”,就会显示一段红色英文,提示创建失败。而日志一直显示Installing CLI plugins. This might take a while...,经过我后面的验证,就是权限不够。
这两个问题统一的解决办法:
首先以管理员命令打开cmd
然后进入你想要创建项目的文件夹,这里我要在C:\Users\18168\Desktop\vue这个文件夹里创建项目,输入cd 文件夹地址。
cd C:\Users\18168\Desktop\vue
这样就进入了这个文件夹,然后就是常规操作,输入vue ui
这个时候你会发现进度条不闪烁了,一直完成创建的操作就可以了,最后你会发现插件也可以下载。
这是创建的时候的配置
接下来这里有一个坑
如果你项目中要引入elementUI的话这里一定要选择2,否则到时候运行的时候会报错。
2.引入elementUI以后运行时报错
报错内容:
ERROR Cannot read properties of undefined (reading 'prototype') TypeError: Cannot read properties of undefined (reading 'prototype') at eval (webpack-internal:///./node_modules/element-ui/lib/utils/types.js:44:115) at ./node_modules/element-ui/lib/utils/types.js (http://192.168.1.6:8080/js/chunk-vendors.js:900:1) at __webpack_require__ (http://192.168.1.6:8080/js/app.js:313:32) at fn (http://192.168.1.6:8080/js/app.js:581:21) at eval (webpack-internal:///./node_modules/element-ui/lib/utils/util.js:18:14) at ./node_modules/element-ui/lib/utils/util.js (http://192.168.1.6:8080/js/chunk-vendors.js:911:1) at __webpack_require__ (http://192.168.1.6:8080/js/app.js:313:32) at fn (http://192.168.1.6:8080/js/app.js:581:21) at eval (webpack-internal:///./node_modules/element-ui/lib/locale/format.js:43:13) at ./node_modules/element-ui/lib/locale/format.js (http://192.168.1.6:8080/js/chunk-vendors.js:556:1)
原因是2和elementUI版本一致,3和elementUI plus一致,使用elementUI时一定要选择2。