0
votes

I have added "@angular-devkit/build-angular" as a devDependency and now when I try to run npm i I get errors such as "yp verb which failed Error: not found: python2". That's because it tries to download "

https://github.com/sass/node-sass/releases/download/v4.9.0/win32-x64-57_binding.node

" and since we are behind a firewall it fails.

I came across "https://github.com/sass/node-sass/issues/1106" which suggests that if I have "nodeSassConfig" in my package.config pointing to a locally downloaded version of win32-x64-57_binding.node it will not go to github and will try to use the local version.

"nodeSassConfig": {
    "binaryPath": "/test-sass/binding.node/win32-x64-57_binding.node"
  },

Even after specifying the value, npm i still tries to access github for win32-x64-57_binding.node.

So, I decided to run a pre-install script to set "SASS_BINARY_PATH" environment variable but for some reason "SASS_BINARY_PATH" requires a complete path not a relative one.

Note that I got this working in a command prompt when I set "SASS_BINARY_PATH" with absolute path to win32-x64-57_binding.node.

I am using Node v 8.2.11 with npm 5.6.0

1

1 Answers

0
votes

I managed to solve this by specifying a preinstall task in package.config/script.

On windows:-

scripts {
"preinstall": "SET SASS_BINARY_PATH=%cd%/test-sass/binding.node/win32-x64-57_binding.node&& npm install node-sass"
}

Note that I have to add %cd% in order to generate the full path as SASS_BINARY_PATH requires absolute path.