4
votes

The packages in my project.json uses the node package manager. I add a new package via nuget to my Visual Studio 2015 ASP.NET 5 Beta 8 project.

When I'm on my home internet I can get download packages. However when I'm at the office I get the following error in my console if I add a new package:

PATH=.\node_modules.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\git C:\Users\USERNAME.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta8\bin\dnx.exe "C:\Users\USERNAME.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta8\bin\lib\Microsoft.Dnx.Tooling\Microsoft.Dnx.Tooling.dll" restore "C:\PROJFOLDER\PROJNAME" -f "C:\Program Files (x86)\Microsoft Web Tools\DNU" Microsoft .NET Development Utility Clr-x86-1.0.0-beta8-15858

GET https://www.nuget.org/api/v2/FindPackagesById()?id='AutoMapper' Error: FindPackagesById: AutoMapper An error occurred while sending the request.

In Visual Studio 2015 Solution Explorer:

enter image description here

I get:

Package restore failed

If I use nuget in a classic class library that doesn't use npm then I am able to download the same packages, so the issue seem to limited to npm

On researching the error it is listed as an issue on GitHub. A workaround listed on the issue is to set a Windows environmental variables to my corporate proxy.

However I don't have proxy settings set in Internet Explorer.

enter image description here

My questions:

  1. How do I determine the proxy I am using?

  2. Is there an alternative way I can get it to work other than setting the environment variables. I tried the dnx.config workaround but it didn't work.

  3. I use the laptop both at work and home. Is their a solution where I don't have to change settings between office and home?

1

1 Answers

6
votes

If your internet works through Internet Explorer you can just add the following section to the machine.config located in the folder C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

<system.net>
    <defaultProxy useDefaultCredentials="true" enabled="true">
        <proxy usesystemdefault="True"/>
    </defaultProxy>
</system.net>

If you get a permission error saving the file, save it to your desktop and copy it from there back to the original location.