npm ERR! code EPERMnpm ERR! syscall mkdirnpm ERR! path D:\ProgramFiles\nodejs\node_global\node_mod
项目场景: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:切换成超级管理员进行安装

安装成功
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)