centos npm run build 报错

报错信息

npm run  build 
> XXXX@0.1.0 build /home/lvph/work/XXXX
> vue-cli-service build

sh: XXXX/node_modules/.bin/vue-cli-service: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! XXX@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the xxxx@0.1.0 build 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!     /home/lvph/.npm/_logs/2020-01-19T01_33_20_803Z-debug.log

解决办法

到项目路径下
rm -rf node_modules
rm package-lock.json
npm cache clear --force
在执行
npm install

最后成功

npm run build

原文地址:https://www.cnblogs.com/lph970417/p/12212507.html