Npm 更新 - npm 错误!系统调用重命名

azz*_*aze 2 rename node.js npm

在我的项目中,我想做一个npm update,但我总是犯这种错误:

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\user\Desktop\SylviaTest\node_modules\bootswatch
npm ERR! dest C:\Users\user\Desktop\SylviaTest\node_modules\.bootswatch-9Qtq80Xi
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\user\Desktop\SylviaTest\node_modules\bootswatch' -> 'C:\Users\user\Desktop\SylviaTest\node_modules\.bootswatch-9Qtq80Xi'
npm ERR!  [Error: EPERM: operation not permitted, rename 'C:\Users\user\Desktop\SylviaTest\node_modules\bootswatch' -> 'C:\Users\user\Desktop\SylviaTest\node_modules\.bootswatch-9Qtq80Xi
'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\user\\Desktop\\SylviaTest\\node_modules\\bootswatch',
npm ERR!   dest: 'C:\\Users\\user\\Desktop\\SylviaTest\\node_modules\\.bootswatch-9Qtq80Xi'
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.
Run Code Online (Sandbox Code Playgroud)

我试过 :

  • 删除packages.lock
  • npm 缓存清理 --force
  • npm 安装
  • npm 安装-g npm

但总是这个错误...有人可以帮助我吗?

小智 6

对于遇到此问题的其他人:请确保没有打开任何可能正在使用这些文件的内容。

  • 如果项目服务器正在运行,请将其关闭。
  • 如果您在 IDE 中打开了该项目,请将其关闭。
  • 如果您在文件浏览器中打开了某些文件,请将其关闭。

然后再次尝试 npm 命令。