node-sass: Post Install fails inside a proxy

Dear all, I am trying to install node-sass inside a proxy properly configured in node npm via npm config set proxy http://myproxy.com:8080

all dependencies works but the post install of node-sass fails

npm info lifecycle node-sass@3.5.1~install: node-sass@3.5.1

  node-sass@3.5.1 install D:\...\node_modules\node-sass
  node scripts/install.js

 Cannot download "https://github.com/sass/node-sass/releases/download/v3.5.1/win32-ia32-47_binding.node": 

 getaddrinfo ENOTFOUND github.com github.com:443

 Hint: If github.com is not accessible in your location
       try setting a proxy via HTTP_PROXY, e.g. 
    export HTTP_PROXY=http://example.com:1234

 or configure npm proxy via
npm config set proxy http://example.com:8080


In the install.js script of the node-sass module, there is the proxy configuration reported below:

function applyProxy(options, cb) {
  var env = process.env;

  options.proxy = env.npm_config_https_proxy ||
                  env.npm_config_proxy ||
                  env.npm_config_http_proxy ||
                  env.HTTPS_PROXY ||
                  env.https_proxy ||
                  env.HTTP_PROXY ||
                  env.http_proxy;

  cb(options);
}

the older versions (that work inside the proxy) are configured with the function as below

function applyProxy(options, cb) {
  npmconf.load({}, function (er, conf) {
    var proxyUrl;

    if (!er) {
      proxyUrl = conf.get('https-proxy') ||
                 conf.get('proxy') ||
                 conf.get('http-proxy');
    }

    var env = process.env;

    options.proxy = proxyUrl ||
                    env.HTTPS_PROXY ||
                    env.https_proxy ||
                    env.HTTP_PROXY ||
                    env.http_proxy;

    cb(options);
  });
}

Thank You!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 7
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Anyone that ends up here might be intrested to know that https://github.com/sass/node-sass/releases/download/v3.5.2/win32-ia32-47_binding.node currently resolves to github-cloud.s3.amazonaws.com. So you may have to add exceptions to your corporate proxy accordingly

I believe I’ve found the issue. We recently our http library and the new open appears to have issues with proxies. I’ll revert this change and release v3.5.3 shortly.