如何解决Choco 无法删除输出文件:访问被拒绝
我遇到了一个烦人的错误,我的目标是安装最新版本的neovim(neovim .5 版)。我目前有neovim .4
- 我第一次卸载了 Neovim
choco uninstall neovim
- 然后我运行了
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
解决方法
DLL 和 exe 在您运行应用程序时被锁定。 您可能正在运行 Neovim 并尝试升级它(我刚刚重现了此错误以确认输出匹配),这解释了为什么它在重新启动 Windows 后工作。
如果您对 .dll 或 .exe 文件设置了“拒绝访问”,请确保您没有运行使用这些文件的应用程序。
您在尝试卸载时也可能遇到了同样的问题。您说您确实卸载了,但错误输出中锁定的文件之一是 C:\tools\neovim\Neovim\bin\nvim.exe
,因此它仍然存在。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。