Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post-install build.js fails #1843

Closed
TekSiDoT opened this issue Dec 21, 2016 · 17 comments
Closed

Post-install build.js fails #1843

TekSiDoT opened this issue Dec 21, 2016 · 17 comments

Comments

@TekSiDoT
Copy link

TekSiDoT commented Dec 21, 2016

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.8

  • Node version (node -v):
    v6.9.1

  • Node 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):
    linux

  • Node architecture (node -p process.arch):
    x64

  • node-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:

node-sass@4.1.1 postinstall /usr/base/node_modules/node-sass
node scripts/build.js

Binary 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?

@xzyfer
Copy link
Contributor

xzyfer commented Dec 22, 2016

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.

@TekSiDoT
Copy link
Author

TekSiDoT commented Dec 23, 2016

Is using SKIP_SASS_BINARY_DOWNLOAD_FOR_CI and supplying a pre-downloaded version via SASS_BINARY_PATH instead not an intended workflow?

@xzyfer
Copy link
Contributor

xzyfer commented Dec 23, 2016

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.

@TekSiDoT
Copy link
Author

great, thank you for the clarification, I'll be able to confirm on Tuesday.

@TekSiDoT
Copy link
Author

Unfortunately, the problem remains unchanged even after removing the SKIP_SASS_BINARY_DOWNLOAD_FOR_CI ENV flag

@xzyfer
Copy link
Contributor

xzyfer commented Dec 28, 2016

I expect the current problem to be different. We cannot help without a full install log.

@TekSiDoT
Copy link
Author

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

@xzyfer
Copy link
Contributor

xzyfer commented Jan 14, 2017

Sorry for the delay, I've started looking into this, it does appear to be bug.

@TekSiDoT
Copy link
Author

No worries, I appreciate you investing time in this, looking forward to your results.

@bf
Copy link

bf commented Feb 1, 2017

Any updates?

@nschonni
Copy link
Contributor

Electron isn't a supported environment for node-sass

@TekSiDoT
Copy link
Author

@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).

@xzyfer xzyfer reopened this Apr 25, 2017
@xzyfer
Copy link
Contributor

xzyfer commented Apr 25, 2017

Sorry this is a legitimate issue I just haven't had the time to get around to yet.

@TekSiDoT
Copy link
Author

Thanks for your time!

@nschonni
Copy link
Contributor

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

describe('SASS_BINARY_PATH', function() {

@sass sass deleted a comment from agpreynolds Oct 6, 2017
@sass sass deleted a comment from drbeka Oct 6, 2017
@layonthebeech
Copy link

Any updates on this?

@saper
Copy link
Member

saper commented Oct 18, 2019

Please see my advice from #2738 (comment) if the issue still persists.

@saper saper closed this as completed Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants