ai-traders / liget

NuGet server and cache running on kestrel in docker
MIT License
219 stars 29 forks source link

Can't install nuget package from LiGet server #8

Closed mersadk closed 5 years ago

mersadk commented 5 years ago

I'm running LiGet server and I've pushed one package to it which was generated by vcpkg.

When I try to install it (from VS2017 or with nuget.exe) I get following error:

An error occurred while retrieving package metadata for 'cc-license-manager_x86-windows-static_20190115.1.0.0' from source 'My Feed'. Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'.

LiGet server can be found at https://nuget.cc-api.com/. I'm not sure if problem is caused by nuget package itself or by LiGet.

tomzo commented 5 years ago

Hi @mersadk We have not used vcpkg packages and I don't know much about it. LiGet is tested extensively with standard nuget packages, so it must be something different about vcpkg. I think what you posted is the error thrown by nuget.exe. So it looks that server is returning metadata content which is not expected by the client.

gggggeorge commented 5 years ago

Hi tomzo,

I just set up your LiGet server on CoreOS.

I've been evaluating BaGet and LiGet, and yours seems to be the way to go -thanks for all the effort (especially docker) you put into it.

I created (via Paket)/pushed/retrieved 3 packages:

A: XYZ.2.0.1.nupkg B: XYZ.2.0.2.nupkg C: XYZ.4.7.0.nupkg


Here are the results:

BaGet: had no issues (from what I'm recalling -this was about 2 month ago. If it had an issue with (A), I don't recall it, sorry).

LiGet: I was able to push all 3 packages to your server, but when I attempted to retrieve them, I had errors for package (A). The other 2 (B, C) had no issues when retrieving them.

The error (below output from Visual Studio 2015) is the same as was previously reported:

Error An error occurred while retrieving package metadata for 'XYZ.2.0.1' from source 'CoreOS (.Net Core: NuGet server)'. Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'. 0


I unzipped/diffed (A) with a "good" package (B -which is similar to C), and I see this difference (there isn't actually 3 blank lines in (A), I just did this to illustrate):

(A):

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
  <metadata>
    <id>XYZ</id>
    <version>2.0.1</version>
    <authors>George H.</authors>
    <description>A 30 day logging utility.</description>

  </metadata>
</package>

(B):

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
  <metadata>
    <id>XYZ</id>
    <version>2.0.2</version>
    <authors>George H.</authors>
    <description>A 30 day logging utility.</description>
    <dependencies>
      <group targetFramework="net35" />
    </dependencies>
  </metadata>
</package>

Notice there is no <dependencies> tag in (A), but there is one in (B) -also in (C).

Could this be causing the issue -I assume you must be parsing this tag to store dependencies in your SQLite DB, and the upload works fine, but not the download...?

Thanks, George H. 02/07/2019 1:59pm ET

tomzo commented 5 years ago

Hi,

Thanks for posting the xml details, this is something to work with. I will have to reproduce it in tests and see if that is the issue.

Do you see that error only in visual studio or is any other client also failing?

gggggeorge commented 5 years ago

Hi tomzo,

from the command line (DOS prompt), I just tried:


Paket (Paket version 5.196.2):

.paket\paket.exe install

-and it worked fine for both (A: 2.0.1) and (C: 4.7.0)


NuGet (NuGet Version: 4.7.1.5393):

nuget install XYZ -version 2.0.1 An error occurred while retrieving package metadata for 'XYZ.2.0.1' from source 'CoreOS (.Net Core: NuGet server)'. Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'.

nuget install XYZ -version 4.7.0 Successfully installed 'XYZ 4.7.0' to C:\PROJECTS\MISC\NUGET_PACKET_TEST\201902072_LiGet_TEST\NUGET Executing nuget actions took 124.57 ms


Hmmmm.... this seems to be a NuGet issue, or Paket is creating packages (the packages were originally created via Paket) not fully compatible with NuGet spec...?

Thanks, George H. 02/07/2019 3:33pm ET

tomzo commented 5 years ago

This is fixed now in 1.0.1. Packages which did not have dependencies had invalid response returned by server. @gggggeorge thanks for detailed feedback. @mersadk your case most likely works now.

gggggeorge commented 5 years ago

Hi @tomzo ,

I just tested your fix, and my problem has been resolved -many thanks!

Thanks, George H. 02/15/2019 11:40am ET