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

Failed at the node-sass@2.0.1 postinstall script 'node scripts/build.js' #808

Closed
WnP opened this Issue Mar 27, 2015 · 25 comments

Comments

Projects
None yet
9 participants
@WnP
Copy link

WnP commented Mar 27, 2015

Hi,

npm tell me to report you this bug, here is the log file, but it's very long, maybe you prefer only just the error:

Error: Error relocating /home/project/project-front/node_modules/gulp-sass/node_modules/node-sass/vendor/linux-x64-node-0.10/binding.node:
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/project/project-front/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:188:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

OS: alpine linux
kernel: Linux 3.14.36-0-grsec
npm: 2.7.3
nodejs: v0.10.33

@am11

This comment has been minimized.

Copy link
Member

am11 commented Mar 27, 2015

Hi, please make a gist showing the output of these commands: https://gist.github.com/am11/9f429c211822a9b15aee

@WnP

This comment has been minimized.

Copy link

WnP commented Mar 27, 2015

@am11 here it is

thanks

@am11

This comment has been minimized.

Copy link
Member

am11 commented Mar 27, 2015

@WnP thanks.

We build Linux binaries using CentOS. It seems like the binary is not compatible with Alpine Linux.

Just for reconfirming, could you repeat those steps with npm install node-sass@alpha? It should install v3.0.0-alpha.0. Again the alpha binaries are also built with CentOS.

@WnP

This comment has been minimized.

Copy link

WnP commented Mar 27, 2015

@am11 one more

does it mean it works?

@WnP

This comment has been minimized.

Copy link

WnP commented Mar 27, 2015

by the way, alpine use musl not glibc, maybe it's a problem for pre-build binary

@am11

This comment has been minimized.

Copy link
Member

am11 commented Mar 27, 2015

Thanks.

does it mean it works?

Nope.

We first download the prebuild binary per the node.js version and platform type. If it fails, the script tries to build the binary from source.

In v2.0.1, the manual build (fallback) was broken. But the fallback mechanism is not the ideal because it requires you to have gcc, g++ (v4.7) and python 2.6 (or 2.7) installed on your system. In your case fallback is not working for this very reason.

Currently, our binaries are compatible with CentOS 5.11+ and Ubuntu 12.0.4 (and some Fedoras). At least this is what I have conformed.

@WnP

This comment has been minimized.

Copy link

WnP commented Mar 27, 2015

Ok, tested with archlinux and works perfectly, will test tomorow (I'm too sleepy right now, sorry) for alpine's build dependency

Thanks

@heyi

This comment has been minimized.

Copy link

heyi commented Mar 27, 2015

2.7.4
v0.12.1
{ http_parser: '2.3',
node: '0.12.1',
v8: '3.28.73',
uv: '1.0.2',
zlib: '1.2.8',
modules: '14',
openssl: '1.0.1m' }
linux
x64
|

node-sass@2.0.1 install /root/temp1/node_modules/node-sass
node scripts/install.js

module.js:338
throw err;
^
Error: Cannot find module '/root/temp1/node_modules/node-sass/scripts/install.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
npm ERR! Linux 2.6.32-358.6.2.el6.x86_64
npm ERR! argv "node" "/usr/local/bin/npm" "install" "node-sass"
npm ERR! node v0.12.1
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE

npm ERR! node-sass@2.0.1 install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@2.0.1 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /root/temp1/npm-debug.log
test.sh: line 15: ./node_modules/.bin/node-sass: No such file or directory
module.js:338
throw err;
^
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at [eval]:1:13
at Object.exports.runInThisContext (vm.js:74:17)
at Object. ([eval]-wrapper:6:22)
at Module._compile (module.js:460:26)
at evalScript (node.js:431:25)
at startup (node.js:90:7)
module.js:338
throw err;
^
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at [eval]:1:13
at Object.exports.runInThisContext (vm.js:74:17)
at Object. ([eval]-wrapper:6:22)
at Module._compile (module.js:460:26)
at evalScript (node.js:431:25)
at startup (node.js:90:7)
test.sh: line 22: cd: node_modules/node-sass/vendor: No such file or directory
module.js:338
throw err;
^
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at [eval]:1:13
at Object.exports.runInThisContext (vm.js:74:17)
at Object. ([eval]-wrapper:6:22)
at Module._compile (module.js:460:26)
at evalScript (node.js:431:25)
at startup (node.js:90:7)

@WnP

This comment has been minimized.

Copy link

WnP commented Mar 27, 2015

@am11 after installing gcc 4.8.3, g++ 4.8.3, make 4.1 and Python 2.7.9, alpha release build as expected, hope the fallback mechanism will be merge in stable :-)

@am11

This comment has been minimized.

Copy link
Member

am11 commented Mar 28, 2015

v2.1.1 stable is released with the fix. :)

@am11 am11 closed this Mar 28, 2015

@am11 am11 removed the Awaiting Response label Mar 28, 2015

@WnP

This comment has been minimized.

Copy link

WnP commented Mar 28, 2015

Oh great! You rocks @am11 ;)

@pikeas

This comment has been minimized.

Copy link

pikeas commented Apr 6, 2015

node-sass 2.1.1 still fails to install under Alpine Linux:

> node-sass@2.1.1 postinstall /node_modules/node-sass
> node scripts/build.js

`linux-x64-iojs-1.6` exists; testing
module.js:335
  Module._extensions[extension](this, filename);
                               ^
Error: Error relocating /node_modules/node-sass/vendor/linux-x64-iojs-1.6/binding.node: __strtod_internal: symbol not found
@am11

This comment has been minimized.

Copy link
Member

am11 commented Apr 6, 2015

@pikeas,
Alpine nix is using UCibc, while our Linux binaries target glibc (which majority distros are using).
Since this is not feasible for us to build binaries for all possible flavors C-runtimes used in varied Linux distributions (in other words, become a sole binary package manager for libsass), unfortunately the only option you have is to manual compilation on install:

SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true npm install node-sass@beta
# or separately export it before installation:
# export SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
@frol

This comment has been minimized.

Copy link

frol commented Jun 7, 2015

[deleted text]

I'm sorry. My mistake. node-sass works fine with Alpine Linux!

@xzyfer

This comment has been minimized.

Copy link
Contributor

xzyfer commented Jun 9, 2015

We don't officially support Alpine Linux.

Although we support more traditional Linux distributions (i.e. Ubuntu and
CentOS) Alpine is different enough that it would require a separate binary
to be built.

This is something we're happy to do with help from the community, but not
something we have time to actively pursue at the moment.
On 7 Jun 2015 05:42, "Vlad Frolov" notifications@github.com wrote:

@am11 https://github.com/am11 It still fails :(

SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true npm install node-sass@beta

\

node-sass@3.0.0-beta.7 install /mnt/node_modules/node-sass
node scripts/install.js

Skipping downloading binaries on CI builds

node-sass@3.0.0-beta.7 postinstall /mnt/node_modules/node-sass
node scripts/build.js

Building: /usr/bin/node node_modules/pangyp/bin/node-gyp rebuild --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

module.js:340
throw err;
^
Error: Cannot find module '/mnt/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
Build failed
npm ERR! Linux 4.0.4-2-ARCH
npm ERR! argv "node" "/usr/bin/npm" "install" "node-sass@beta"
npm ERR! node v0.10.38
npm ERR! npm v2.11.0
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.0.0-beta.7 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.0.0-beta.7 postinstall script 'node scripts/build.js'.

Without SPIP_SASS_BINRAY_DOWNLOAD_FOR_CI=true it fails with the following
error:

Error: Error relocating /usr/lib/node_modules/este-todomvc/node_modules/sass-loader/node_modules/node-sass/vendor/linux-x64-node-0.10/binding.node: __strtod_internal: symbol not found

BTW, Alpine uses musl libc, not UClibc since April 2014.


Reply to this email directly or view it on GitHub
#808 (comment).

@frol

This comment has been minimized.

Copy link

frol commented Jun 9, 2015

@xzyfer I'm sorry for that. node-sass works on Alpine Linux! I had some garbage in my node_modules folder, which was the cause of the error.

@am11

This comment has been minimized.

Copy link
Member

am11 commented Jun 9, 2015

Unlike prior versions, the recent releases of Apline use libc. What libsass binary doesn't supported is micro-Clib runtime, which some Linux distributions still consume.

@lili21

This comment has been minimized.

Copy link

lili21 commented Feb 25, 2016

I run into the same issue. Here is the output.

> node scripts/build.js

`darwin-x64-node-0.12` exists; testing
module.js:355
  Module._extensions[extension](this, filename);
                               ^
Error: dlopen(/Users/markli/dev/napos/gulp-workflow/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node, 1): no suitable image found.  Did find:
    /Users/markli/dev/napos/gulp-workflow/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node: truncated mach-o error: segment __TEXT extends to 864256 which is past end of file 818459
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/markli/dev/napos/gulp-workflow/node_modules/node-sass/lib/index.js:188:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "link"
npm ERR! node v0.12.9
npm ERR! npm  v2.14.9
npm ERR! code ELIFECYCLE
npm ERR! node-sass@2.1.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@2.1.1 postinstall script 'node scripts/build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.
@xzyfer

This comment has been minimized.

Copy link
Contributor

xzyfer commented Feb 25, 2016

Please follow the steps in the troubleshooting guide.

You're also running a very old version of node-sass. Please update.
On Feb 25, 2016 7:12 PM, "li.li" notifications@github.com wrote:

I run into the same issue. Here is the output.

node scripts/build.js

darwin-x64-node-0.12 exists; testing
module.js:355
Module._extensions[extension](this, filename);
^
Error: dlopen(/Users/markli/dev/napos/gulp-workflow/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node, 1): no suitable image found. Did find:
/Users/markli/dev/napos/gulp-workflow/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node: truncated mach-o error: segment __TEXT extends to 864256 which is past end of file 818459
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/Users/markli/dev/napos/gulp-workflow/node_modules/node-sass/lib/index.js:188:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "link"
npm ERR! node v0.12.9
npm ERR! npm v2.14.9
npm ERR! code ELIFECYCLE
npm ERR! node-sass@2.1.1 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@2.1.1 postinstall script 'node scripts/build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.

I just run into this issue when I use npm link . It works well with npm
install . -g


Reply to this email directly or view it on GitHub
#808 (comment).

@xeor

This comment has been minimized.

Copy link

xeor commented Apr 25, 2016

Do anyone have any updates on installing node-sass on alpine? Or is everyone installing node-sass@beta setting SKIP_SASS_BINARY_DOWNLOAD_FOR_CI? For my case, it breaks other packages which are not ready for sass 3.5+. Example sass-loader@3.2.0 wants node-sass@^3.4.2.

Using npm install on version 3.4 gives errors as well, even with the mentionend environment variable sat.

@xzyfer

This comment has been minimized.

Copy link
Contributor

xzyfer commented Apr 26, 2016

Do anyone have any updates on installing node-sass on alpine?

We still do not officially support Alpine Linux.

Or is everyone installing node-sass@beta

There no beta any more, just install node-sass

setting SKIP_SASS_BINARY_DOWNLOAD_FOR_CI

This should not be required. If binary fails to load on install (which it will on Alpine) it'll be compiled locally.

it breaks other packages which are not ready for sass 3.5+. Example sass-loader@3.2.0 wants node-sass@^3.4.2.

It appears that you misunderstand semver - ^3.4.2 means greater or equal to 3.4.2 and less than 4.0.0. That means 3.5.0 will work fine.

Using npm install on version 3.4 gives errors as well, even with the mentionend environment variable sat.

Without at the very least providing these errors I don't know what you expect from us.

@xeor

This comment has been minimized.

Copy link

xeor commented Apr 26, 2016

Strange.. I had a lot of trouble getting this to work yesterday. There must have been an old version of the npm cache (or something) that bit me, this worked perfectly today!
I also though semver acted that way, but the @beta did work, ^3.4.2 did not. I must have overlooked something...

Lots of output truncated

localhost { ~ }$ docker run -it --rm alpine:3.3 sh
/ # apk update
/ # apk add nodejs python make g++
/ # npm install node-sass sass-loader
/ # npm list node-sass sass-loader
/
├── node-sass@3.6.0
└── sass-loader@3.2.0

Everything is good! Thanks!

@shouze

This comment has been minimized.

Copy link

shouze commented May 30, 2016

@am11 we're using Alpine Linux too... and it's very painful on our CI to see node-sass compiled every time & taking so much time (btw it works perfectly under Alpine Linux).

Is the node-sass distribution process automated? How (which tool) do you use to compile it under CentOS?

Would be super cool to produce an Alpine Linux compatible binary too, I can make a PR if you want.

BTW I've seen #56 but still unclear to me how do you proceed today for artifacts distribution.

@am11

This comment has been minimized.

Copy link
Member

am11 commented May 30, 2016

@shouze, our binary building is party automated. For Windows, all bins are built on AppVeyor CI, then we download the artifacts and upload them as release assets manually. For Linux, we build on CentOS for maximum compatibility. At some point we were using this Docker script https://gist.github.com/am11/1529b2458b1a1f4bdba8 which produces all variants of binaries (arch x node.js module versions). We can potentially compile against musl by having a similar docker recipe.

Furthermore, it would also require some alteration in our binary naming convention to disambiguate varied C-runtimes: https://github.com/sass/node-sass/blob/a04e84d/lib/extensions.js#L171. For instance, something to let both linux-ia32-44_binding.node and linux-musl-ia32-44_binding.node co-exist. At runtime or during the installation, we can detect it by checking whether the output of require('os').release() contains "musl" or "alpine".

@shouze

This comment has been minimized.

Copy link

shouze commented May 30, 2016

Ok, thx @am11! So it would require 2 dedicated Dockerfiles to automate on Linux libc variants. I can take inspiration from the one for centOS in the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment