报错
$ npm i -g electron
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Users\mac\AppData\Roaming\npm\node_modules\electron\node_modules
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Users\mac\AppData\Roaming\npm\node_modules\electron\node_modules'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'C:\Users\mac\AppData\Roaming\npm\node_modules\electron\node_modules'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'C:\Users\mac\AppData\Roaming\npm\node_modules\electron\node_modules'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Users\\mac\\AppData\\Roaming\\npm\\node_modules\\electron\\node_modules'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Users\\mac\\AppData\\Roaming\\npm\\node_modules\\electron\\node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mac\AppData\Roaming\npm-cache\_logs\2022-02-05T17_36_54_641Z-debug.log
截图
C:\Users\mac\AppData\Roaming\npm\node_modules\electron 成了空文件夹,无法进入,无法删除,无法rm -Rf,无法移动命名,无法npm安装.....
解决办法
安装360,右下角搜索工具“文件粉碎机”,
添加路径,删除,即可!