1. 程式人生 > >npm install 報錯(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解決方法

npm install 報錯(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解決方法

win npm support comm project 需要 event sin 命令

npm ERR! path E:\SouthernPowerGridProject\web_project\AutoOPS\autoops\node_modules\fsevents\node_modules\dashdash\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall scandir
npm ERR! Error: EPERM: operation not permitted, scandir ‘E:\SouthernPowerGridProject\web_project\AutoOPS\autoops\node_modules\fsevents\node_modules\dashdash\node_modules‘
npm ERR! { Error: EPERM: operation not permitted, scandir ‘E:\SouthernPowerGridProject\web_project\AutoOPS\autoops\node_modules\fsevents\node_modules\dashdash\node_modules‘
npm ERR! stack: ‘Error: EPERM: operation not permitted, scandir \‘E:\\SouthernPowerGridProject\\web_project\\AutoOPS\\autoops\\node_modules\\fsevents\\node_modules\\dashdash\\node_modules\‘‘,
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM‘,
npm ERR! syscall: ‘scandir‘,
npm ERR! path: ‘E:\\SouthernPowerGridProject\\web_project\\AutoOPS\\autoops\\node_modules\\fsevents\\node_modules\\dashdash\\node_modules‘ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.


npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ThinkT420\AppData\Roaming\npm-cache\_logs\2017-10-30T06_50_38_610Z-debug.log



之前有時報這個,以為還真是權限不夠,感覺有點奇怪,用管理員權限執行,有時還真有用,不過後面查了下,時緩存的問題,清理下緩存就行,不用管理員權限。

方法1、

需要刪除npmrc文件。

強調:不是nodejs安裝目錄npm模塊下的那個npmrc文件

而是在C:\Users\{賬戶}\下的.npmrc文件..

方法2、

或者直接用命令清理就行,控制臺輸入:

npm cache clean --force



added 114 packages in 42.369s
E:\SouthernPowerGridProject\web_project\AutoOPS\autoops>npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.


E:\SouthernPowerGridProject\web_project\AutoOPS\autoops>npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


added 114 packages in 42.369s

成功了

npm install 報錯(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解決方法