'dotnet add package bootstrap gives 404 error with source nuget.org

I'm trying to add bootstrap to a new dotnet core razor app.

C:\dev\core>dotnet --version
2.1.302

I created the project with the command below and have made any changes yet.

dotnet new razor

But now when I try to add the bootstrap nuget package I get the following error. Is this supposed to work? The package is present on the nuget website at https://www.nuget.org/packages/bootstrap/4.1.1

C:\dev\core>dotnet add package bootstrap -v 4.1.1 -s http://nuget.org
  Writing C:\Users\me\AppData\Local\Temp\tmpA9E3.tmp
info : Adding PackageReference for package 'bootstrap' into project 'C:\dev\core\myproj.csproj'.
log  : Restoring packages for C:\dev\core\myproj.csproj...
info :   GET http://nuget.org/FindPackagesById()?id='bootstrap'&semVerLevel=2.0.0
info :   NotFound http://nuget.org/FindPackagesById()?id='bootstrap'&semVerLevel=2.0.0 2324ms
log  : Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.org/FindPackagesById()?id='boo
tstrap'&semVerLevel=2.0.0'.
log  : Response status code does not indicate success: 404 (Not Found).
info :   GET http://nuget.org/FindPackagesById()?id='bootstrap'&semVerLevel=2.0.0
info :   NotFound http://nuget.org/FindPackagesById()?id='bootstrap'&semVerLevel=2.0.0 705ms
log  : Retrying 'FindPackagesByIdAsyncCore' for source 'http://nuget.org/FindPackagesById()?id='boo
tstrap'&semVerLevel=2.0.0'.
log  : Response status code does not indicate success: 404 (Not Found).
info :   GET http://nuget.org/FindPackagesById()?id='bootstrap'&semVerLevel=2.0.0
info :   NotFound http://nuget.org/FindPackagesById()?id='bootstrap'&semVerLevel=2.0.0 698ms
error: Failed to retrieve information about 'bootstrap' from remote source 'http://nuget.org/FindPa
ckagesById()?id='bootstrap'&semVerLevel=2.0.0'.
error:   Response status code does not indicate success: 404 (Not Found).


Solution 1:[1]

It seems that to access the nuget.org packages, api.nuget.org is the source to use. This command worked:

dotnet add package bootstrap -v 4.1.1 -s http://api.nuget.org

Solution 2:[2]

Check if you have a NuGet.config with wrong sources.

You man have correctly configured Nuget sources globally, but the Nuget.config has a non-existent source.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kristianp
Solution 2 Vagner Gon