Angular-CLI with SASS offline

Viewed 839

I am trying to compile an Angular project with SASS using Angular-CLI. My server is behind a firewall, and cannot pull files from the Internet. It can, however, connect to an npm repo that has pre-approved packages. I have downloaded and copied win32-x64-48_binding.node to a local folder and set the SASS-BINARY-PATH environment variable to point to this file.

I have created the project using the command:

ng new myproject --style=sass

Then I restored the packages with:

npm install --sass-binary-path=d:\path\to\win32-x64-48_binding.node

So far, so good. Finally when I run:

ng build

I get the error:

Error in ./src/app/app.component.sass Module build failed: Error: ENOENT: no such file or directory, scandir 'd:\Projects\Angular\myproject\node_modules\node-sass\vendor'

...

I don't have a vendor directory because I installed the binding.node using a different binary path. What do I need to do to get the ng build to work with this offline/SASS scenario?

1 Answers

Add the SASS_BINARY_PATH variable to your System Environment Variables. This is because binding parameters for node-sass only work during npm install. They won't be used during compilation; such as, ng build or ng serve

Related