今天下载了一个前端项目,想看看,运行的时候发现报错如下,然后尝试了很多方法,例如将文件夹node_modules 删除,再执行 npm/cnpm install 进行重新安装,折腾了很久这里记录一下

sh: vue-cli-service: command not found
npm ERR! code 127
npm ERR! path /Users/liuwenqiang/workspace/vue/d2-admin-start-kit
npm ERR! command failed
npm ERR! command sh -c vue-cli-service serve --open

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/liuwenqiang/.npm/_logs/2021-02-09T13_25_52_173Z-debug.log
npm ERR! code 127
npm ERR! path /Users/liuwenqiang/workspace/vue/d2-admin-start-kit
npm ERR! command failed
npm ERR! command sh -c npm run serve

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/liuwenqiang/.npm/_logs/2021-02-09T13_25_52_216Z-debug.log

既然找不到命令,我们就全局安装一下,但是又出现安装超时

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npmjs.org/ms/-/ms-2.0.0.tgz failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/liuwenqiang/.npm/_logs/2021-02-09T13_34_47_191Z-debug.log

我们切换一下国内镜像,然后重新执行

npm install nrm
nrm use taobao
npm install @vue/cli-service -g

Logo

前往低代码交流专区

更多推荐