添加--unsafe-perm 参数,如 #npm install --unsafe-perm 或者再来个淘宝镜像 #npm install --registry=https://registry.npm.taobao.org --unsafe-perm 说明:npm会有生命周期,某个包会有生命周期来执行一些东西,安全起见会自动降级导致没有权限执行一些操作,通过--unsafe-perm参数来解锁该限制。 一劳永逸的方法: npm config set unsafe-perm(针对当前用户的) npm config -g set unsafe-perm(全局的) npm install --unsafe-perm=true --allow-root将后边加上以上参数完美解决! 相关文章: