[英]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.
如果您有任何问题,请考虑使用“重新添加/更新”部分。
Right click libman.json
右键单击
libman.json
click on Disable Client-Side Libraries on Build
单击
Disable Client-Side Libraries on Build
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
,将光标移到文件的最左侧,但在行号的右侧
A little light bulb should show up.应该会出现一个小灯泡。
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
(在我的情况下,我已经拥有最新版本。)
Select the version you want and VS will autofill the version on that line.选择您想要的版本,VS 将自动填充该行上的版本。
<NameOfProject>.csproj
file)<NameOfProject>.csproj
文件)Add
-> Client-Side Library...
Add
-> Client-Side Library...
jquery@
, and then a dropdown list should appear allowing you to select the version you want.jquery@
,然后应该会出现一个下拉列表,允许您选择所需的版本。libman.json
file.libman.json
文件中。 Make sure to also delete the previous library if Visual Studio doesn't do that for you automatically.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.