全局安装npm包报错 Error: EACCES: permission denied, mkdir '/Users/lyc/.npm/sentry-cli'
$ sudo npm i -g @sentry/cli
/usr/local/bin/sentry-cli -> /usr/local/lib/node_modules/@sentry/cli/bin/sentry-cli
> @sentry/cli@1.47.1 install /usr/local/lib/node_modules/@sentry/cli
> node scripts/install.js
Error: EACCES: permission denied, mkdir '/Users/lyc/.npm/sentry-cli'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @sentry/cli@1.47.1 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @sentry/cli@1.47.1 install 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/lyc/.npm/_logs/2019-08-04T00_15_56_196Z-debug.log
权限问题,解决方案: --unsafe-perm=true --allow-root
$ sudo npm i -g @sentry/cli --unsafe-perm=true --allow-root