【问题标题】:npm ERR code EPERM syscall unlink while executing npm install执行 npm install 时 npm ERR 代码 EPERM syscall unlink
【发布时间】:2021-06-28 18:18:26
【问题描述】:

执行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

我试过了:

  1. npm cache clean --force
  2. 删除 node_modules 并重新安装
  3. 已禁用防病毒软件
  4. 正在重启笔记本电脑:)

【问题讨论】:

    标签: npm node-modules npm-install


    【解决方案1】:

    我可以解决这个问题

    1. 关闭所有打开的提示和编辑器,例如。 VSCode。
    2. 以管理员身份打开终端或 CMD 并再次运行 npm-install

    我认为 IDE 正在“锁定文件”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-09
      • 1970-01-01
      • 2021-07-29
      • 1970-01-01
      • 2023-02-17
      • 2019-07-28
      • 2018-05-12
      相关资源
      最近更新 更多