今天准备弄一下vue-element-admin,在github上下载好压缩包,下好git,下好python,配置好环境变量,就等npm i
就当我那npm i的时候,果不其然,报错了。心里头一万头草泥马
3656 error code ENOENT
3657 error syscall spawn git
3658 error path git
3659 error errno ENOENT
3660 error enoent Error while executing:
3660 error enoent undefined ls-remote -h -t ssh://git@github.com/sohee-lee7/Squire.git
3660 error enoent
3660 error enoent
3660 error enoent spawn git ENOENT
3661 error enoent This is related to npm not being able to find a file.
网上查阅资料五花八门的,有的说配置git环境变量,有的说是在git里面配置url,我都按照做了,依旧报这个错误,搞了我两个多小时,然后关机重启,再运行
npm install --registry=https://registry.npm.taobao.org
然后奇迹般的可以了,我晕,真是玄学!!
紧接着运行项目:全是英文,真是爽的不要不要的
网上找的解决方案:
- 可以把下载的vue-element-admin切换带到i18n的分支上面
- 切换到 i18n 的分支 git checkout i18n
- 查看当前分支 git branch -vv
运行git checkout i18n就出错:
fatal: not a git repository (or any of the parent directories): .git
说是没有.git的目录,需要git init ,好吧,我又照做了,还是不行,最后参阅了一个大神的方法:
在main.js中找到这两处代码注释即可
//import enLang from 'element-ui/lib/locale/lang/en'
Vue.use(Element, {
size: Cookies.get('size') || 'medium', // set element-ui default size
// locale: enLang // 如果使用中文,无需设置,请删除
})
然后框框一顿注释,打开还是没用,后面才发现根源所在,我直接去下一个国际版就行了
https://github.com/PanJiaChen/vue-element-admin/tree/i18n
重复一下之前的操作,界面就变成中文的啦,可算是解决了!!