简体   繁体   English

利伯曼。 构建应用程序期间出现错误 LIB002

[英]Libman. Error LIB002 during build application

I'm working with asp.net core web app and trying to use libmam to manage client-side libs.我正在使用 asp.net 核心网络应用程序并尝试使用 libmam 来管理客户端库。 I'm turn on "Enable Client-Side Libreries on Build" and write some code in libman.json:我打开“在构建时启用客户端库”并在 libman.json 中编写一些代码:

{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "defaultDestination": "wwwroot/lib",
  "libraries": [
    {
      "library": "jquery@3.3.1",
      "destination": "wwwroot/lib/jquery/"
    }
   ]
}

Restoring libs works fine if I'm using "Restore Client-Side Libraries".如果我使用“恢复客户端库”,恢复库可以正常工作。 But when I'm trying to build application I'm getting an error:"libman.json : error LIB002: The "jquery@3.3.1" library could not be resolved by the "cdnjs" provider".但是当我尝试构建应用程序时,我收到一个错误:“libman.json:错误 LIB002:“cdnjs”提供程序无法解析“jquery@3.3.1”库”。

How can I solve the problem?我该如何解决这个问题?

So the reason, at least from what I've found, is that the library no longer exists or is not being seen by "cdnjs" provider.因此,至少从我发现的情况来看,原因是该库不再存在或“cdnjs”提供者没有看到。

The best way to deal with this is to update the library to a library that "cdnjs" does support.处理这个问题的最好方法是将库更新为“cdnjs”确实支持的库。 If you in fact already have the library installed consider using the "Disable libman" section.如果您实际上已经安装了库,请考虑使用“禁用 libman”部分。

The below instructions are being done on Visual Studio 2022, mileage may vary for other versions.以下说明是在 Visual Studio 2022 上完成的,其他版本的里程可能会有所不同。 If you have any issues consider using the "Re-add/Update" section.如果您有任何问题,请考虑使用“重新添加/更新”部分。

Disable libman禁用 libman

  1. Right click libman.json右键单击libman.json

  2. click on Disable Client-Side Libraries on Build单击Disable Client-Side Libraries on Build

在此处输入图像描述

Update your library更新你的图书馆

  1. In your libman.json move your cursor over to the left most side of the file but to the right of the line numbers在您的libman.json ,将光标移到文件的最左侧,但在行号的右侧

  2. A little light bulb should show up.应该会出现一个小灯泡。

在此处输入图像描述

  1. Click on the down arrow单击向下箭头

在此处输入图像描述

  1. You'll be greeted with a couple of options, Click on Check for updates (in my case I already have the latest version.)您将看到几个选项,单击Check for updates (在我的情况下,我已经拥有最新版本。)

  2. Select the version you want and VS will autofill the version on that line.选择您想要的版本,VS 将自动填充该行上的版本。

Re-add/update your library.重新添加/更新您的库。

  1. In the Solution Explorer, right-click on the name of your Project (This is usually the <NameOfProject>.csproj file)在解决方案资源管理器中,右键单击您的项目名称(这通常是<NameOfProject>.csproj文件)
  2. select Add -> Client-Side Library...选择Add -> Client-Side Library...

在此处输入图像描述

  1. In the dialog box that appears, type jquery@ , and then a dropdown list should appear allowing you to select the version you want.在出现的对话框中,键入jquery@ ,然后应该会出现一个下拉列表,允许您选择所需的版本。

在此处输入图像描述 在此处输入图像描述

  1. Click on the Install button and that will add the new library to your libman.json file.单击安装按钮,这会将新库添加到您的libman.json文件中。 Make sure to also delete the previous library if Visual Studio doesn't do that for you automatically.如果 Visual Studio 没有自动为您执行此操作,请确保也删除以前的库。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有网络的LibMan阻止构建。 有本地后备选项吗? - LibMan without internet prevents build. Is there a local fallback option? 如何修复 angular2 和 .net 核心应用程序中的“错误:找不到模块‘webpack/lib/dependencies/ContextElementDependency’”! - How to fix "Error: Cannot find module 'webpack/lib/dependencies/ContextElementDependency'" in angular2 and .net core application.! 使用本地文件系统复制 libman unpkg - Replicating libman unpkg with a local filesystem Libman - 如何安装已安装库的依赖项 - Libman - How to install dependencies of installed library 混淆VS2022中的Nuget和Libman - Confuse about Nuget and Libman in VS2022 如何使用libman而不是npm来下载typescript定义 - How to use libman instead of npm to download typescript definitions ASP NET Core:如何在build上创建wwwroot / lib - ASP NET Core: How to create wwwroot/lib on build error NETSDK1031:不支持在不指定 RuntimeIdentifier 的情况下构建或发布自包含应用程序 - error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier VSO ASP.NET5 CI构建期间出错 - “您的项目使用不同版本的TypeScript编译器”但我没有使用TypeScript - Error during VSO ASP.NET5 CI build - “Your project uses a different version of the TypeScript compiler” but I'm not using TypeScript .NET Blazor构建错误 - .NET Blazor Build error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM