Node-sass is one of famous library used by Node Js projects now days. Node–sass is a library that provides binding for Node.js to LibSass, the C version of the popular stylesheet preprocessor,Sass. It allows you to natively compile .scss files to css at incredible speed and automatically via a connect middleware.
When you install this library it download binary as per the machine on which you are running it.
Like if you are on a windows machine 64 bit architecture, it will try to download
“win32-x64-57_binding.node” and different binary in case of other OS.
It works all fine when you are on a machine where you have no internet restrictions in term of opening a site like in this case these binaries are located on GITHUB. So if you have access to github you will see ‘npm install’ going smooth.
But what if your organization mandates to use private artifactory solution like JFrog and have no access to Github ??
Don’t worry we have solution for this =)
I am going to tell you two ways to tackle this situation, one for old version of node-sass like nodes-sass@4.5.3 (it was in my case) and one is for latest versions which are more configurable.
Node-sass do provide a way to specify custom site/location to download binaries in case your organization not allow to connect to github, explained here at this link.
But this works with latest versions of node-sass like 4.9.4 on wards, in this case you download the binaries to a local directory and during “npm install” specify flag –sass-binary-dir=d:/node-sass-binary so final command would be “npm install
–sass-binary-dir=d:/node-sass-binary ” this will pick binaries from this custom path instead of Github.
But what if you have old version and which also not support these flags, in that case when you see this error,
– you have to download that specific binary from node-sass github site for example
win32-x64-57_binding.node
– drop that file into npm-cache location of your machine , standard path would be like
C:\Users\<user>\AppData\Roaming\npm-cache\node-sass\4.5.3\
– run “npm install node-sass”
this will resolve your issues. Please do let leave your comments if this is helpful.