NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 253 forks source link

Package Manager Error: Unable to load the service index for source (bad proxy settings) #2880

Closed klaykuban closed 6 years ago

klaykuban commented 8 years ago

nuget

Following error received when searching for packages in the package manager

[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json. Invalid URI: Invalid port specified.

rrelyea commented 8 years ago

What version of NuGet are you using in VS? can you please send a fiddler trace to support@nuget.org

This is likely a bad proxy, or an older version of NuGet?

klaykuban commented 8 years ago

NuGet package Manager v 3.4.4.1321

How can I find the fiddler trace? I'm fairly new to visual studio and such.

dmantovani73 commented 8 years ago

Today I'm experimenting the same problem (in the past few days everything worked fine). If I run Fiddler I don't see any HTTP call but I got the error. What can I do?

Thanks

klaykuban commented 8 years ago

I finally ran Fiddler and saw the same. No HTTP but have the error

dmantovani73 commented 8 years ago

Finally I found the issue, at least in my case: if no Windows HTTP proxy is specified, NuGet uses (if present) the HTTP Proxy specified in the environment variable http_proxy.

klaykuban commented 8 years ago

Were you able to fix the issue?

dmantovani73 commented 8 years ago

Yes, removing the env var http_proxy fixed the issue (in my case).

klaykuban commented 8 years ago

Sorry i'm not too familiar with how to do that. How can i remove that env var?

dmantovani73 commented 8 years ago

Open "System Properties" > Advanced > Environment Variables. Find the http_proxy var (in System variables), select and delete it.

klaykuban commented 8 years ago

Incredible. It worked! Thanks big time. I've been stuck at this point for well over a month

nkuhan commented 8 years ago

In mac os x shell I typed export ALL_PROXY=proxy ip address :port number then typed dotnet restore It's work fine

KasunKoswattha commented 7 years ago

For me, a simple VS restart fixed the issue.

zchpit commented 7 years ago

In my computer I should go to catalog: C:\Users\myUserName\AppData\Roaming\NuGet

And edit NuGet.xml file:

Working file looks like this:

[Uploading NuGet.txt…]()

HydTechie commented 7 years ago
  1. Copy Nuget.exe by any peer projects via copying .nuget folder to "NONWorking" project folder..
  2. In windows, IE has proxy settings, some times its gets checked for no great reason... uncheck, if you dont use proxy.
  3. restore the solution in VS 2015.. I got it resolved on my machine.
vsg24 commented 7 years ago

For me removing the .nuget folder located in C:\Users\YourNameHere fixed the problem.

mishrsud commented 7 years ago

@VSG24 Thanks a ton! Removing .nuget from my profile (C:\Users\.nuget) worked like a charm!

Environment: Windows 10 Pro RTM x64 dotnet SDK version 1.0.0-rc4-004771 Shell: Native Windows Command Shell

microsmith commented 7 years ago

My issue was simple... my virtual machine lost internet connectivity!

shafatahmad commented 7 years ago

Can somebody help me with this issue? I am not using any kind of proxy and I have a brand new install of VS 2017 ..


[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request.
  The remote name could not be resolved: 'api.nuget.org'
Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request.
  The remote name could not be resolved: 'api.nuget.org'
Time Elapsed: 00:00:38.4173999
========== Finished ==========

``
![using package manager console](https://cloud.githubusercontent.com/assets/16449737/26712265/b29657ce-4783-11e7-9768-64c8d9849dfc.png)
`
d-arkhipenko commented 7 years ago

Hi all, if you use Ubuntu server, this error fixed by install : https://www.howtoinstall.co/en/ubuntu/xenial/libcurl3

9Rune5 commented 7 years ago

Would be nice if the error message could say "cannot reach 93.184.221.200" or similar (basically tell me which host or IP that couldn't be reached).

Today our IDS had blocked nuget, because it believed the nuget host had performed a port scan on us. I doubt that is likely (far more likely that our frequent builds trigger lots of traffic to the nuget servers and this confused a poorly configured IDS).

In any case..: A nicer error message would have sorted out our problem faster.

solomon1271 commented 7 years ago

Restarting VS works for me too.

tyeth commented 7 years ago

Had no environment variables mentioned here, was using new .Net IDE called Rider, on ubuntu, libcurl3 was already present.

Ended up setting the IDE to use a proxy and then saved and then set to no proxy and saved. Solved.

Thought it was a versioning issue as I'm using an old vs2015 project, but even changing the version used by project didn't help. Although it resolved a separate issue for me as mono supported .net >=4.5 and I had it targetting 4.5 but forgot I needed a nuget package thats linked to 4.6 :)

AndreiRinea commented 7 years ago

Had the same issue today, removed .nuget folder from my profile folder and it started working again. The other things before (env var etc.) didn't work.

Luca4k4 commented 7 years ago

Hi, i've the same problem.. I tryed to remove .nuget folder but it is still not working. In my environment variables i did not find any http_proxy var. I've this problem for days, please help me to solve it! :(

VishalTank3010 commented 7 years ago

I have the same problem. Can I manually download and install the package in my project? Actually, I have installed the same package( Which I want in a new project but this problem sucks) in another project, So is there any way to use it in another project directly?

VishalTank3010 commented 7 years ago

Go for Settings ( Global Settings of your PC ) > Network and Internet > Proxy > Automatic Proxy Setup > and set Automatically detect settings to off. This Works for me.... Try this ...

Luca4k4 commented 7 years ago

I solved the problem! Thank you @VishalTank3010

nhannguyen95 commented 6 years ago

@nkuhan Hi, could you elaborate the command? What is the value of ip address and port number? I encountered this problem on my Mac too.

jagowm commented 6 years ago

I have the same issue: unable to load the service index for source https://api.nuget.org/v3/index.json fot timeout Please help me out

emgarten commented 6 years ago

Closing as this looks like a local environment problem and not an actionable client issue.

hasanOryx commented 6 years ago

It gave bash: export::port': not a valid identifierwhen I triedexport ALL_PROXY=proxy ip address :port numbera Mac, what is theport` tobe used?

daiz93 commented 6 years ago

Firstly i was removing the .nuget folder located in C:\Users\YourNameHere fixed the problem. but wen i have creat another new project in VS i have the same problem

So i have do remove this environnemental variable path value : C:\Program Files\dotnet and update VS 17. i'm on Windows 10 Pro.

daiz93 commented 6 years ago

else you can download and install this https://cloudnimble.gallerycdn.vsassets.io/extensions/cloudnimble/nugetpackagereferenceupgrader/1.0.1/1508705706028/281869/2/NuGet%20PackageReference%20Upgrader%20v1.0.1.vsix and restart your laptop

prisar commented 6 years ago

i am having this problem in docker-compose error : Unable to load the service index for source

SGuzel commented 6 years ago

How can i fix this without disable the enviroment variable http_proxy?

For now it is working for me. just adjust the Nuget.Config in Users...\Appdata\Roaming\Nuget

<configuration>
  <config>
    <add key="HTTP_PROXY" value="http://proxy_server_name:8080/" />
  </config>
  <packageSources>
    <add key="nuget.org" value="http://api.nuget.org/v3/index.json" protocolVersion="3" />
nichitaciuprin commented 6 years ago

Managed to fix the issue using "dotnet restore" command in "Package Manager Console"

parashu1987 commented 6 years ago

I did not have http_proxy variable set on my machine, fix was to run the visual studio in admin mode. with this i was removed the above error.

shupoval commented 6 years ago

In my case, there was no env variable http_proxy

I've fixed this issue by creating nuget.exe.config in the same folder as nuget.exe

C:\Program Files (x86)\NuGet\nuget.exe.config

<configuration>  
  <system.net>  
    <defaultProxy 
      enabled="false"  
          useDefaultCredentials="true">
    </defaultProxy>  
  </system.net>  
</configuration>
notorandxor commented 6 years ago

Fixed by adding protocolVersion="3" in C:\Users\UserName\AppData\Roaming\NuGet\NuGet.config.

<packageSources>
   <add key="nuget.org_v3" 
             value="https://api.nuget.org/v3/index.json" 
             protocolVersion="3" />
</packageSources>
ericssonanders commented 6 years ago

In our case it was the account actually running nuget.exe that did not have appropriate permissions. We ended up using the "runAs" team city plugin to solve this, running specific features with different user accounts.

xhafan commented 6 years ago

My virtual machine in VirtualBox has broken networking after waking up PC from a sleep. I always have to change the network adapter's "attached to" value, confirm the change and revert it back. Example: change "attached to" from NAT to "bridged adapter", confirm, and revert it back.

dlidstrom commented 5 years ago

For me this problem occurred after I installed Fiddler and a session with Fiddler crashed unexpectedly. It seems Fiddler had failed to restore some functionality related to the network settings of my laptop (or whatever). Once I ran Fiddler again and successfully ended the session (actually just opening Fiddler) all of a sudded NuGet runs fine! I discovered this by opening https://api.nuget.org/v3/index.json in Chrome and seeing that it worked fine there, so the problem was within Visual Studio itself, or some application that had affected its settings. So that's how I suspected Fiddler. Anyway, maybe this helps someone.

blackjyn commented 5 years ago

Many thanks to all of you. The 'root' problem above also causing another problems such as: Xamarin error MSB4019.... etc.. etc.. depending on what project you are building

I was finally resolve the problem by doing the following step:

codebased commented 5 years ago

in 2018 we are still struggling to resolve a proxy issue. Microsoft Visual Studio does not either provide an option to define a proxy location. You have to manually go to devenv config to set this up. Nuget issue is still not resolved after spending 2 hours. !!!

nigel-dewar commented 5 years ago

Same problem for me. really annoying. Every day now I think about switching to Java and leaving MS behind.

syyam commented 5 years ago

Do these steps

  1. Delete .nuget from c/users/[username]
  2. Restart your VS and make sure you are connected to the internet.
  3. Build the solution
vmpatel commented 5 years ago

Do these steps

  1. Delete .nuget from c/users/[username]
  2. Restart your VS and make sure you are connected to the internet.
  3. Build the solution

Is that worked for you?

vmpatel commented 5 years ago

For me it was firewall issue and now it is working like a charm.

RockNHawk commented 5 years ago

If in Linux, I was able to get restore working on my Solus box by first running
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0. Once I did that, dotnet restore worked.

export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 
dotnet restore
ben-tcgplayer commented 5 years ago

I had recently installed/uninstalled Fiddler and was getting this error and ended up having to add defaultProxy settings back to C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe.config https://stackoverflow.com/questions/46500032/unable-to-load-the-service-index-for-source-https-api-nuget-org-v3-index-json?rq=1