wakers01
wakers01

Reputation: 443

NPM Error in Visual Studio 2015 Update 2, Unable to restore packages

I have created a new ASP.NET 5 project from the Web Application template. That template includes dependencies for Bower and npm. When attempting to restore the npm dependencies, I get the following message:

Error: 20888:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:787:

My initial searching has lead me to believe this is because I'm behind a corporate proxy, and that updating my npm config to use the non-https url using npm config set registry http://registry.npmjs.org/ may resolve the issue.

The problem I am having is just my ignorance of where to do that. npm is not a recognized command in my command line obviously because I haven't installed anything locally other than Visual Studio. So, is there a way in Visual Studio to update this config? How can I go about troubleshooting this issue?

enter image description here

Upvotes: 0

Views: 1785

Answers (1)

wakers01
wakers01

Reputation: 443

So, it did, in fact, end up being a proxy issue. Because I'm behind a corporate proxy, I needed to set the proxy in npm. Oleg pointing out the directory for the npm utility allowed me to navigate there and mess with configs. To solve this issue:

  1. Open the command prompt and navigate to "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\npm.cmd"
  2. Set the proxy using "npm config set proxy http://yourProxy:portNumber"
  3. Set the secure proxy using "npm config set https-proxy http://yourProxy:portNumber"
  4. In my case, my corporate proxy was an automatic configuration script (http://pac.server.com), so I had to hit that from a browser to download the proxy file. Then I found the primary proxy channel for Web in the proxy file and used that when configuring the proxy settings.

Upvotes: 0

Related Questions