首页 > 解决方案 > Choco 无法删除输出文件:访问被拒绝

问题描述

我遇到了一个恼人的错误,我的目标是安装最新版本的 neovim(neovim 版本 .5)。我目前有neovim .4

  1. 我首先通过以下方式卸载了 neovimchoco uninstall neovim
  2. 然后我跑choco install neovim --pre
ERROR: Can not delete output file : Access is denied. : C:\tools\neovim\Neovim\bin\lua51.dll
ERROR: Can not delete output file : Access is denied. : C:\tools\neovim\Neovim\bin\msgpackc.dll
ERROR: Can not delete output file : Access is denied. : C:\tools\neovim\Neovim\bin\nvim.exe
ERROR: Can not delete output file : Access is denied. : C:\tools\neovim\Neovim\bin\uv.dll
ERROR: Can not delete output file : Access is denied. : C:\tools\neovim\Neovim\bin\winpty.dll
ERROR: 7-Zip encountered a fatal error while extracting the files. This is most likely an issue with the 'neovim' package and not with Chocolatey itself. Please follow up with the package maintainer(s) directly.
The install of neovim was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\neovim\tools\chocolateyinstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - neovim (exited 2) - Error while running 'C:\ProgramData\chocolatey\lib\neovim\tools\chocolateyinstall.ps1'.
 See log for details.

错误中提到的日志文件如下所示:

2021-06-16 23:53:13,553 4908 [DEBUG] - Moving 'C:\ProgramData\chocolatey\lib\neovim'
 to 'C:\ProgramData\chocolatey\lib-bad\neovim'
2021-06-16 23:53:15,557 4908 [DEBUG] - Attempting to delete file "C:\Users\15732\AppData\Local\NuGet\Cache\neovim.0.5.0-beta.nupkg".
2021-06-16 23:53:16,104 4908 [WARN ] - 
Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2021-06-16 23:53:16,104 4908 [INFO ] - 
2021-06-16 23:53:16,104 4908 [ERROR] - Failures
2021-06-16 23:53:16,104 4908 [ERROR] -  - neovim (exited 2) - Error while running 'C:\ProgramData\chocolatey\lib\neovim\tools\chocolateyinstall.ps1'.
 See log for details.
2021-06-16 23:53:16,104 4908 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2021-06-16 23:53:16,135 4908 [DEBUG] - Exiting with 2

标签: neovimchocolatey

解决方案


运行应用程序时,DLL 和 exe 被锁定。您可能正在运行 Neovim 并尝试升级它(我刚刚重现了此错误以确认输出匹配),这解释了为什么它在重新启动 Windows 后工作。

如果您对 .dll 或 .exe 文件有“拒绝访问”,请确保您没有运行使用这些文件的应用程序。

此外,您在尝试卸载时可能遇到了同样的问题。您说您确实卸载了,但错误输出中的锁定文件之一是C:\tools\neovim\Neovim\bin\nvim.exe,因此它仍然存在。


推荐阅读