1. 程式人生 > >npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall access

npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall access

error

npm ERR! path /usr/local/lib/node_modules/webpack-cli/node_modules/wrap-ansi
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/usr/local/lib/node_modules/webpack-cli/node_modules/wrap-ansi'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kuntao/.npm/_logs/2018-12-20T15_04_35_284Z-debug.log

解決方法

這種error資訊一般出現在mac電腦安裝某個依賴到全域性的情況下,這是因為你的許可權不夠,無法將此模組安裝到全域性環境。只需要在你的npm命令前面加上一個sudo即可。

sudo npm install xxx -g