错误消息:缺少根元素

错误消息:缺少根元素

更新全部时巧克力味软件包时,会出现以下错误信息:

Root element is missing.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

chocolatey.log 详细信息

2020-05-19 11:44:14,947 22876 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2020-05-19 11:44:14,953 22876 [ERROR] - Root element is missing.
2020-05-19 11:44:14,958 22876 [ERROR] - More Details: System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at NuGet.XmlUtility.LoadSafe(Stream input, Boolean ignoreWhiteSpace)
   at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider, Boolean validateSchema)
   at NuGet.LocalPackage.ReadManifest(Stream manifestStream)
   at NuGet.UnzippedPackage.EnsureManifest(String manifestFilePath)
   at NuGet.LocalPackageRepository.OpenPackage(String path)
   at NuGet.LocalPackageRepository.GetPackage(Func`2 openPackage, String path)
   at NuGet.LocalPackageRepository.<GetPackages>d__28.MoveNext()
   at NuGet.CollectionExtensions.AddRange[T](ICollection`1 collection, IEnumerable`1 items)
   at NuGet.LocalPackageRepository.FindPackagesById(Func`2 openPackage, String packageId)
   at NuGet.PackageRepositoryExtensions.FindPackagesById(IPackageRepository repository, String packageId)
   at NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions, Boolean allowUnlisted)
   at chocolatey.infrastructure.app.services.NugetService.upgrade_run(ChocolateyConfiguration config, Action`1 continueAction, Boolean performAction, Action`1 beforeUpgradeAction)
   at chocolatey.infrastructure.app.services.NugetService.upgrade_run(ChocolateyConfiguration config, Action`1 continueAction, Action`1 beforeUpgradeAction)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.perform_source_runner_function[T](ChocolateyConfiguration config, Func`2 function)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.upgrade_run(ChocolateyConfiguration config)
   at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action`1 parseArgs)
   at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Container container)
   at chocolatey.console.Program.Main(String[] args)

版本信息

使用 Chocolatey v0.10.15 进行测试

答案1

原因

零字节 nupkgs 或 nuspec 文件会导致此问题。这些包文件是从 Chocolatey nuget 服务器下载的,可能会损坏/为空,例如当磁盘已满时。

解决方法

找到并删除零字节文件,这应该可以解决问题。这是一个手动解决方法,直到 Chocolatey 可以处理此问题。

查找并删除*.nu*此目录树中的空文件:

目录:\ProgramData\chocolatey\lib

来源和问题状态

问题:https://github.com/chocolatey/choco/issues/717

相关内容