cannot install any packages - ERROR -https://packagesource

HELEN TRAN 1 Reputation point
2022-10-13T09:04:24.997+00:00

-[Package source] Unable to load the service index for source https://packagesource.
An error occurred while sending the request.

-Restore could not be completed because the listed source is unavailable.

-PM> Install-Package Newtonsoft.Json
Install-Package : Unable to find package 'Newtonsoft.Json' at source ''.
At line:1 char:1

  • Install-Package Newtonsoft.Json
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (:) [Install-Package], Exception
  • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManag
    ement.PowerShellCmdlets.InstallPackageCommand
Developer technologies | Visual Studio | Debugging
Developer technologies | .NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,441 Reputation points Microsoft External Staff
    2022-10-13T13:23:30.717+00:00

    Hello @HELEN TRAN ,

    Welcome to Microsoft Q&A forum.

    Please open Visual Studio > Tools > NuGet Package Manager > Package Manager Settings > Package Sources > check if any invalid package sources are still list there, if so try to remove them or uncheck them, and make sure that the valid package source like nuget.org is checked, then retry installing NuGet package.

    Besides, you may need to try to clean NuGet cache, see this document for details: Clearing local folders.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.