You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows PowerShell中Scoop无法读取shim文件及更新失败求助

解决Scoop更新失败、找不到shim文件的问题

步骤1:修复Scoop目录权限

  • 以管理员身份打开PowerShell,执行命令赋予目录完全控制权限:
    icacls "C:\Windows\System32\apps\scoop" /grant Users:F /T
    

步骤2:手动创建缺失的目录

  • 执行命令生成报错中提到的new目录:
    New-Item -Path "C:\Windows\System32\apps\scoop\new" -ItemType Directory -Force
    

步骤3:重新安装Scoop核心

  • 先备份已安装应用列表(可选):
    scoop export > scoop_apps.json
    
  • 运行重新安装命令,指定原目录路径:
    irm get.scoop.sh -outfile install.ps1
    .\install.ps1 -ScoopDir "C:\Windows\System32\apps\scoop" -NoProxy
    

步骤4:验证修复并重建shim

  • 尝试更新Scoop:
    scoop update
    
  • 若仍有shim错误,重建所有应用的shim文件:
    scoop shim reset *
    

额外建议

  • 不推荐将Scoop安装在System32这类系统目录,权限限制和系统保护机制容易引发读写异常。如果可行,建议迁移到用户目录(如C:\Users\[你的用户名]\scoop):
    1. 导出应用列表(执行scoop export > scoop_apps.json)
    2. 卸载当前Scoop:scoop uninstall scoop
    3. 重新运行安装脚本,默认会安装到用户目录
    4. 导入应用列表:scoop import scoop_apps.json

原报错信息:

PS C:\Windows\System32\apps\railway\current> scoop update
Updating Scoop...
Cannot open shim file for read.
Could not read shim file.
Remove-Item : Cannot find path 'C:\Windows\System32\apps\scoop\new' because it does not exist.
At C:\Windows\System32\apps\scoop\current\libexec\scoop-update.ps1:79 char:13
+             Remove-Item $newdir -Force -Recurse
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Windows\System32\apps\scoop\new:String) [Remove-Item], ItemNotFoun
   dException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

Scoop download failed. If this appears several times, try removing SCOOP_REPO by 'scoop config rm SCOOP_REPO'

内容的提问来源于stack exchange,提问作者user13137381

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 10:35:20