I'm attempting to install node-sass as a dependency of an advanced ng2/electron seed inside a Docker container running behind a corporate firewall controlled by a Jenkins CI instance.
NPM version (
npm -v):
3.10.8Node version (
node -v):
v6.9.1Node Process (
node -p process.versions):
{ http_parser: '2.7.0',
node: '6.9.1',
v8: '5.1.281.84',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '57.1',
modules: '48',
openssl: '1.0.2j' }Node Platform (
node -p process.platform):
linuxNode architecture (
node -p process.arch):
x64node-sass version (
node -p "require('node-sass').info"):- npm node-sass versions (
npm ls node-sass):
not applicable, attempting to install v4.1.1
This is the relevant part of the respective Dockerfile, it is build from node:6.9.1 which is itself based on Debian Jessie.
ENV SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=1
ENV SASS_BINARY_PATH=/usr/base/binaries/
ENV SASS_BINARY_NAME=linux-x64-48
COPY ./ /usr/base
The correct copy process of the binary has been confirmed.
The installation process fails during the postinstall call to build.js:
[email protected] postinstall /usr/base/node_modules/node-sass
node scripts/build.jsBinary found at /usr/base/binaries/
Testing binary
Binary has a problem: { Error: Cannot find module '/usr/base/binaries/'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (/usr/base/node_modules/node-sass/lib/binding.js:19:10)
at Object.(/usr/base/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12) code: 'MODULE_NOT_FOUND' }Building the binary locally
Building: /usr/local/bin/node /usr/base/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
The following local compilation via node-gyp fails, again because the following GET is blocked by a firewall:
GET https://nodejs.org/download/release/v6.9.1/node-v6.9.1-headers.tar.gz
While this isn't really the problem, I'm also open to workarounds based on supplying cached node header files to node-gyp.
Any ideas?
By setting ENV SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=1 you're forcing a local compilation. In order for node-gyp to compile locally it needs the headers for your version of node. By blocking that download the binary cannot be compiled so the build step will fail.
Is using SKIP_SASS_BINARY_DOWNLOAD_FOR_CI and supplying a pre-downloaded version via SASS_BINARY_PATHinstead not an intended workflow?
No it is not. SKIP_SASS_BINARY_DOWNLOAD_FOR_CI is an an internal, undocumented flag scheduled for removal. SASS_BINARY_PATH is all you need.
great, thank you for the clarification, I'll be able to confirm on Tuesday.
Unfortunately, the problem remains unchanged even after removing the SKIP_SASS_BINARY_DOWNLOAD_FOR_CI ENV flag
I expect the current problem to be different. We cannot help without a full install log.
I have created a gist containing the complete install log along with the used Dockerfiles, thanks for your efforts.
http://gist.github.com/TekSiDoT/0904eb396e50685c6c8e22540660c461
Sorry for the delay, I've started looking into this, it does appear to be bug.
No worries, I appreciate you investing time in this, looking forward to your results.
Any updates?
Electron isn't a supported environment for node-sass
@nschonni This is not about running node-sass in Electron but about a bug handling a flag concerning the offline use of node-sass during a build process. This same could be reported using any number of projects (among others: @angular/cli).
Sorry this is a legitimate issue I just haven't had the time to get around to yet.
Thanks for your time!
The headers is the target option from node-gyp https://github.com/nodejs/node-gyp#command-options
When supplying the sass-binary-path, it assumes that is the full path including the binding.node https://github.com/sass/node-sass/blob/a14fbe5b3bf374c6d4192b7e2079e3812712fa92/test/runtime.js#L86
Any updates on this?
Please see my advice from https://github.com/sass/node-sass/issues/2738#issuecomment-542960751 if the issue still persists.
Most helpful comment
Any updates?