{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/2979","labels_url":"https://api.github.com/repos/nodejs/node/issues/2979/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/2979/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/2979/events","html_url":"https://github.com/nodejs/node/issues/2979","id":107481502,"number":2979,"title":"Getting the error \"Assertion failed (wrap->ssl_) != (nullptr), file src\\tls_wrap.cc, line 320\" while module installation by npm","user":{"login":"SergeKornilov","id":13131956,"avatar_url":"https://avatars.githubusercontent.com/u/13131956?v=3","gravatar_id":"","url":"https://api.github.com/users/SergeKornilov","html_url":"https://github.com/SergeKornilov","followers_url":"https://api.github.com/users/SergeKornilov/followers","following_url":"https://api.github.com/users/SergeKornilov/following{/other_user}","gists_url":"https://api.github.com/users/SergeKornilov/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeKornilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeKornilov/subscriptions","organizations_url":"https://api.github.com/users/SergeKornilov/orgs","repos_url":"https://api.github.com/users/SergeKornilov/repos","events_url":"https://api.github.com/users/SergeKornilov/events{/privacy}","received_events_url":"https://api.github.com/users/SergeKornilov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/tls","name":"tls","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-09-21T10:09:52Z","updated_at":"2015-09-21T23:05:42Z","closed_at":null,"body":"I get the error \"Assertion failed (wrap->ssl_) != (nullptr), file src\\tls_wrap.cc, line 320\" trying to install any module by npm via proxy, for example, request or cheerio:\r\n\r\nnpm config set proxy http://username:password@proxy.company.com:8080\r\nnpm config set https-proxy https://username:password@proxy.company.com:8080\r\n\r\nnpm install cheerio\r\n\r\n//\r\n\r\nThus, request module is not installed at all, and cheerio module is installed without dependencies.\r\n\r\n//\r\n\r\nnpm --version\r\n2.14.3\r\n\r\nnode --version\r\nv4.1.0\r\n\r\nOS: windows xp sp3"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/142133692","html_url":"https://github.com/nodejs/node/issues/2979#issuecomment-142133692","issue_url":"https://api.github.com/repos/nodejs/node/issues/2979","id":142133692,"user":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T23:05:42Z","updated_at":"2015-09-21T23:05:42Z","body":"I think it may be a windows-specific thing. May I ask you to give a try to the following patch:\r\n\r\n```diff\r\ndiff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js\r\nindex 1bff757..fc9696f 100644\r\n--- a/lib/_tls_wrap.js\r\n+++ b/lib/_tls_wrap.js\r\n@@ -296,7 +296,11 @@ proxiedMethods.forEach(function(name) {\r\n \r\n tls_wrap.TLSWrap.prototype.close = function closeProxy(cb) {\r\n   if (this._parentWrap && this._parentWrap._handle === this._parent) {\r\n-    setImmediate(cb);\r\n+    if (this._parentWrap._handle)\r\n+      this._parentWrap.once('close', cb);\r\n+    else\r\n+      setImmediate(cb);\r\n+\r\n     return this._parentWrap.destroy();\r\n   }\r\n   return this._parent.close(cb);\r\n```\r\n\r\nHopefully, it will fix the problem\r\n\r\n---------\r\n\r\n@saghul a question about Windows and `uv_close()`. There is lots of endgames and everything for cancelling the request. Could it be the case that the `uv_close_cb` is not invoked on next libuv tick on Windows?"}}