如何解决npm ERR 代码 EPERM 系统调用在执行 npm install
执行 npm install
时出现以下错误
节点版本 12.16.2 以管理员身份运行cmd
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted,unlink 'D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5'
npm ERR! [OperationalError: EPERM: operation not permitted,unlink 'D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5'] {
npm ERR! cause: [Error: EPERM: operation not permitted,unlink 'D:\Projects\BTP\Medical-Project\client\node_modules\.staging\npm-9e4fc1a9\man\man5\package-locks.5'] {
npm ERR! errno: -4048,npm ERR! code: 'EPERM',npm ERR! syscall: 'unlink',npm ERR! path: 'D:\\Projects\\BTP\\Medical-Project\\client\\node_modules\\.staging\\npm-9e4fc1a9\\man\\man5\\package-locks.5'
npm ERR! },npm ERR! stack: "Error: EPERM: operation not permitted,unlink 'D:\\Projects\\BTP\\Medical-Project\\client\\node_modules\\.staging\\npm-9e4fc1a9\\man\\man5\\package-locks.5'",npm ERR! errno: -4048,npm ERR! code: 'EPERM',npm ERR! syscall: 'unlink',npm ERR! path: 'D:\\Projects\\BTP\\Medical-Project\\client\\node_modules\\.staging\\npm-9e4fc1a9\\man\\man5\\package-locks.5',npm ERR! parent: 'client'
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\kz\AppData\Roaming\npm-cache\_logs\2021-04-01T18_15_01_424Z-debug.log
我试过了:
npm cache clean --force
- 删除 node_modules 并重新安装
- 禁用杀毒软件
- 重新启动笔记本电脑:)
解决方法
我能够通过以下方式解决此问题
- 关闭所有打开的提示和编辑器,例如。 VSCode。
- 以管理员身份打开终端或 CMD 并再次运行
npm-install
。
我认为 IDE 正在“锁定文件”。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。