Azure DevOps + LibMan + UNPKG 间歇性错误 LIB010:无法从 unpkg.com 下载资源

Posted

技术标签:

【中文标题】Azure DevOps + LibMan + UNPKG 间歇性错误 LIB010:无法从 unpkg.com 下载资源【英文标题】:Azure DevOps + LibMan + UNPKG Intermittent Error LIB010: Failed to download resource from unpkg.com 【发布时间】:2019-09-13 19:51:38 【问题描述】:

我已经在 Azure DevOps 上设置了持续集成,但我一直遇到一个间歇性问题,即 libman 无法下载资源这里有几个示例:

##[error]libman.json(0,0): Error LIB010: Failed to download resource from "http://unpkg.com/devextreme@18.2.6/dist/css/icons/dxiconsmaterial.woff2"

##[error]libman.json(0,0): Error LIB010: Failed to download resource from "http://unpkg.com/globalize@1.4.2/dist/globalize-runtime/date.js"

##[error]libman.json(0,0): Error LIB010: Failed to download resource from "http://unpkg.com/cropperjs@2.0.0-alpha/src/js/preview.js"

导致错误的总是不同的包,所以我假设这是一个超时问题(太慢或者我滥用它 - 不确定)。

这是实际的异常消息:

exception was thrown --- [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error :    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error :    at Microsoft.Web.LibraryManager.CacheService.<RefreshCacheAsync>d__9.MoveNext() [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error : --- End of stack trace from previous location where exception was thrown --- [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error :    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): error :    at Microsoft.Web.LibraryManager.Providers.Unpkg.UnpkgProvider.<RefreshCacheAsync>d__22.MoveNext() [d:\a\1\s\MyAppPortal\MyAppPortal.csproj]
[error]C:\Users\VssAdministrator\.nuget\packages\microsoft.web.librarymanager.build\1.0.172\build\Microsoft.Web.LibraryManager.Build.targets(35,9): Error : Microsoft.Web.LibraryManager.Contracts.ResourceDownloadException: Failed to download resource from "http://unpkg.com/knockout@3.4.0/package.json"
   at Microsoft.Web.LibraryManager.WebRequestHandler.<GetStreamAsync>d__5.MoveNext()

我该如何解决这个问题?有没有办法像 VS 在运行构建时一样在 DevOps 上缓存和重用下载的包?

【问题讨论】:

【参考方案1】:

LibraryManager package 的更新版本会重试下载几次。安装最新版本,看看是否有助于解决问题。

【讨论】:

虽然从技术上讲是一个正确的解决方案,但我已经实施,并且极大地改善了我的构建成功,所以谢谢。我还注意到在某些情况下我的构建持续时间从 10 分钟跃升至 50 分钟——现在我必须为更多的构建代理付费! :(

以上是关于Azure DevOps + LibMan + UNPKG 间歇性错误 LIB010:无法从 unpkg.com 下载资源的主要内容,如果未能解决你的问题,请参考以下文章

如何将 Azure DevOps Extension for Azure CLI 与 Azure DevOps Server 一起使用?

Azure DevOps系列Azure DevOps构建.NET EFCore应用程序

azure devops cloud 和 azure devops server 2019 之间的区别

如何从 Azure Devops 服务器迁移到 Azure Devops 服务中的现有组织

Tfs / Azure DevOps 客户端库合并 Azure DevOps 分支上的冲突解决

Azure DevOps 介绍