执行npm install
时出现以下错误
节点版本12.16.2以管理员身份运行cmd
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:ProjectsBTPMedical-Projectclientnode_modules.stagingnpm-9e4fc1a9manman5package-locks.5
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:ProjectsBTPMedical-Projectclientnode_modules.stagingnpm-9e4fc1a9manman5package-locks.5'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'D:ProjectsBTPMedical-Projectclientnode_modules.stagingnpm-9e4fc1a9manman5package-locks.5'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'D:ProjectsBTPMedical-Projectclientnode_modules.stagingnpm-9e4fc1a9manman5package-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:UserskzAppDataRoamingnpm-cache_logs2021-04-01T18_15_01_424Z-debug.log
我试过了:
npm cache clean --force
- 已删除node_modules并重新安装
- 已禁用防病毒
- 正在重新启动笔记本电脑:(
我能够通过解决这个问题
- 关闭任何打开的提示和编辑器,例如VSCode
- 以管理员身份打开终端或CMD并再次运行
npm-install
我认为IDE正在"锁定文件"。