0

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

wakers01
  • 443
  • 3
  • 18
  • Try to open HTTPS URL https://registry.npmjs.org/gulp-concat in your web or in Visual Studio (Open File...). The file with JSON data should be displayed. The error GET_SERVER_HELLO looks like TLS (https) error. The client send to the server "ClientHello" request and the server should send back so named "ServerHello" response, which you seems not to get. Visual Studio should use the proxy of IE (see in Tools/Options and then in Environment/Web Browser). By the way you can try to use `npm install` in the command line in project directory. – Oleg Apr 12 '16 at 15:14
  • When I hit the URL from IE, I do get the file back just fine, so maybe not a proxy issue then? I literally have no idea why I'm getting this error in Visual Studio then. It definitely only happens on my corporate network though. – wakers01 Apr 12 '16 at 16:16
  • Also, using npm install in the command line in the project directory just gives tells me that npm is not a recognized command. – wakers01 Apr 12 '16 at 16:38
  • It could be that you have some kind of version issue of npm which you use. You can examine `C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\npm.cmd` files which Visual Studio uses. See [the old answer](http://stackoverflow.com/a/33612739/315935) – Oleg Apr 12 '16 at 16:40
  • Aha! It is a proxy issue. Pointing me to the location of the npm utility helped a lot. Thanks, Oleg. – wakers01 Apr 12 '16 at 18:52
  • You are welcome! I'm glad that I could help you. – Oleg Apr 12 '16 at 19:10

1 Answers1

0

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.
wakers01
  • 443
  • 3
  • 18