背景
再一次vue-element-admin使用中,安装依赖时报错,当然第一次就是 删除package-lock.json一般都可以解决,但是这次不但没有解决,还有其他错误,错误如下:
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/sohee-lee7/Squire.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
解决方案
直接将git的cmd命令添加到系统环境变量即可,D:\Program Files\Git\cmd(自己的目录)
注意:记得命令行关闭重新打开,再进行安装。.
【腾讯云】11.11云上盛惠,云服务器首年1.8折起,买1年送3个月!境外云服务器15元/月起,买更多省更多!
https://cloud.tencent.com/act/cps/redirect?redirect=5559&cps_key=3e0f3ba5c4cc727403e88457eb5c4914&from=console