ubuntu root用户安装vue-cli错误

38312 error code ELIFECYCLE
38313 error syscall spawn
38314 error file sh
38315 error errno ENOENT
38316 error yorkie@2.0.0 install: `node bin/install.js`
38316 error spawn ENOENT
38317 error Failed at the yorkie@2.0.0 install script.
38317 error This is probably not a problem with npm. There is likely additional logging output above.

解决办法,添加后缀

npm install -g @vue/cli @vue/cli-service-global --unsafe-perm

原因

For security reasons, if you run npm install as root, npm will set the user to “nobody” when running postinstall scripts, which does not have access to the project directory, thus the error message.

原文地址:https://www.cnblogs.com/YC-L/p/13900164.html