JWT nuget package cannot be restored

0

I have dotnet core installed on CentOS, and a project that is using JWT

https://www.nuget.org/packages/JWT/3.1.1

Locally on my OSX the restore works perfectly well:

dotnet --info
.NET Command Line Tools (2.0.3)

Product Information:
Version:            2.0.3
Commit SHA-1 hash:  eb1d5ee318

Runtime Environment:
OS Name:     Mac OS X
OS Version:  10.13
OS Platform: Darwin
RID:         osx.10.12-x64
Base Path:   /usr/local/share/dotnet/sdk/2.0.3/

Microsoft .NET Core Shared Framework Host

Version  : 2.0.3
Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

Server:

dotnet --info
.NET Command Line Tools (2.0.3)

Product Information:
Version:            2.0.3
Commit SHA-1 hash:  c85173f757

Runtime Environment:
OS Name:     centos
OS Version:  7
OS Platform: Linux
RID:         centos.7-x64
Base Path:   /opt/rh/rh-dotnet20/root/usr/lib64/dotnet/sdk/2.0.3/

Microsoft .NET Core Shared Framework Host

Version  : 2.0.3
Build    : N/A

But on the server it doesn't work:

dotnet add package JWT --version 3.1.1
Writing /tmp/tmphdc0Ux.tmp
error: Unable to load the service index for source 
https://api.nuget.org/v3/index.json.
error:   The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
error:   The type initializer for 'Http' threw an exception.
error:   The type initializer for 'HttpInitializer' threw an exception.
error:   Unable to load DLL 'System.Net.Http.Native': The specified module or one of its dependencies could not be found.
error:    (Exception from HRESULT: 0x8007007E)

dotnet installation commands:

yum install centos-release-dotnet
yum install rh-dotnet20 

I tried dotnet clean, and tried to change package version to newer or older, nothing works. Other packages in my .csproj are restored successfully, any advice would be really appreciated.

.net
asp.net-core
nuget
asked on Stack Overflow Jan 17, 2018 by CodeBird • edited Jan 17, 2018 by CodeBird

1 Answer

2

This error happens when some native prerequisites of .NET Core aren't met. In this case, libcurl either doesn't exist or an incompatible version is installed

Consult the Prerequisites for .NET Core on Linux document and make sure you use the latest versions (currently .NET Core Sdk 2.1.4 where you have been using 2.0.3)

answered on Stack Overflow Jan 17, 2018 by Martin Ullrich

User contributions licensed under CC BY-SA 3.0