全局安装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
也是npm install Error Error: EACCES: permission denied, open 'xxx'
提示是权限够不,但是添加sudo之后,后续仍然其他的权限问题
解决方案:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
npm 运行报错 Cannot find file: 'index.js' does not match the corresponding name on disk: 'xxx '
报错结果整体如下
Failed to compile.
./src/components/model/Monkey.jsx
Cannot find file: 'index.js' does not match the corresponding name on disk: './node_modules/Konva/lib/konva'.
其实就是找不到对应模块。
看了一下引入模块的地方 是这么写的 import Konva from 'Konva'
把Konva
改成konva
即可