vuex 跑npm run serve报错‘Failed at the vuex-demo...’

317 阅读1分钟

错误信息

sh: vue-cli-service: command not found

npm ERR! file sh

npm ERR! code ELIFECYCLE

npm ERR! errno ENOENT

npm ERR! syscall spawn

npm ERR! vuex-demo1@0.1.0 serve: vue-cli-service serve

npm ERR! spawn ENOENT

npm ERR!

npm ERR! Failed at the vuex-demo1@0.1.0 serve script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/xxx/.npm/_logs/2021-07-22T03_32_26_260Z-debug.log

image.png

修改:

删除 node_modules文件夹:rm -rf node_modules/
安装 cnpm: cnpm install

再跑: npm run serve 就好了。