Using node-sass behind a firewall

LibSass is written in C/C++. It offers various wrappers for use, including node-sass.

npm install node-sass pulls the pre-built Sass lib from GitHub.

This won’t work you in a corporate network. You will typically see this error:


This could mean that the proxy is not right but it is also likely that the corporate network is blocking the connection. Next you will see this is in log.


What’s happening here is that the npm installer is trying to build the binary since it could not download the pre-built version. This will get tricky since the build script is going to look for C++ compiler and Python install.


There are a few ways to deal with this


Looks like this was added by the Linked guys to  get around the firewall problem. This isn’t particularly well documented. See this commit for details. IMO this isn’t the best option since it relies on a fairly specific site hosting scheme.


This takes the full path including the name of the binary. This path is used to look up the local binary. For example:

npm install --sass_binary_path="C:\src\v3.3.6\win32-x64-46_binding.node"

This is the best option, IMO.

Download the binary. Package it locally and npm install with the flag.


This only takes a part of the binary name. From the code (node_modules\node-sass\lib\extensions.js), the full name is resolved like so:

return [binaryName, 'binding.node'].join('_');

This seems to be used for constructing the download url. So not much use in this scenario.


2 thoughts on “Using node-sass behind a firewall

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s