项目场景:npm install -g nodemon报错
报错如下·
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\ProgramFiles\nodejs\node_global\node_modules\.staging
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\ProgramFiles\nodejs\node_global\node_modules\.staging'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'D:\ProgramFiles\nodejs\node_global\node_modules\.staging'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'D:\ProgramFiles\nodejs\node_global\node_modules\.staging'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\ProgramFiles\\nodejs\\node_global\\node_modules\\.staging'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\ProgramFiles\\nodejs\\node_global\\node_modules\\.staging'
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! D:\ProgramFiles\nodejs\node_cache\_logs\2024-01-11T13_06_26_574Z-debug.log
报错原因 :
权限不足
解决方法1:
命令改成局部安装
npm install nodemon
解决方法2:切换成超级管理员进行安装
安装成功