执行

npm install 

 

编译出错,提示

ERR! sharp EACCES: permission denied, mkdir '/root/.npm'
info sharp Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag

npm  为安全考虑,不支持以root 用户运行,

官方说明在这里https://docs.npmjs.com/cli/v6/using-npm/config#unsafe-perm

这之后可以加个参数 

--unsafe-perm

 

也就是

npm install --unsafe-perm