webpack npm 報錯問題集合

全局安裝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-rootnode

$ sudo npm i -g @sentry/cli --unsafe-perm=true --allow-root

也是npm install Error Error: EACCES: permission denied, open 'xxx'

提示是權限夠不,可是添加sudo以後,後續仍然其餘的權限問題npm

解決方案:this

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 '

報錯結果總體以下debug

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'.

其實就是找不到對應模塊。code

看了一下引入模塊的地方 是這麼寫的 import Konva from 'Konva'Konva改爲konva便可component

相關文章
相關標籤/搜索