Node-sass: segmentation fault with sass-maps (linux only)

Created on 21 Oct 2016  Â·  21Comments  Â·  Source: sass/node-sass

  • NPM version (npm -v): 3.10.8
  • Node version (node -v): 6.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: '56.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"):
node-sass   3.10.1  (Wrapper)   [JavaScript]
libsass     3.3.6   (Sass Compiler) [C/C++]

How to reproduce:

This is my test file test.scss:

$maptest: (
    key: value
);

Now if I run node-sass test.scss I only get a segfault without further information.

This happens _only_ on linux and not on my macOS with this exact same versions.

I need to go back to version 3.4.x to get it to work.

Edit: I corrected the example and removed the semicolon.

Invalid - Old Node-Sass crash npm install

Most helpful comment

You can try this:

cd node_modules/node-sass
node scripts/build -f

Rebuilding the script worked for me, I have the same problem on a debian wheezy x64 server with latest node-sass version.

Even if it's just a workaround, not a solution 😕

All 21 comments

Running on sassmeister
Ruby Sass http://www.sassmeister.com/gist/d1818c04f24967097bcc093da093e0e4
Gives:

Invalid CSS after " key: value": expected ")", was ";"

libsass

unclosed parenthesis on line 2 at column 8

The map shouldn't have a ; http://sass-lang.com/documentation/file.SASS_REFERENCE.html#maps

I am sorry, that was my fault. My map is without that semicolon! Please reopen.

edit: I corrected the example above!

I'll investigate this issue in LibSass. An error should be produced, not a segfault.

@ausminternet which version of Linux is this exactly? Can you give me your installed libstdc++ version? Where does your node come from?

I can confirm: it looks like this is the same as #1738: recompiling libsass solves the problem.

Tested on Debian wheezy x64:

$ ./node_modules/.bin/node-sass test.scss 
Segmentation fault
$ cd node_modules/node-sass && node scripts/build -f && cd ../..
[...]
$ ./node_modules/.bin/node-sass test.scss 

$

And the libstdc++ version is 3.4.17:

$ /sbin/ldconfig -p | grep stdc++
    libstdc++.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
$ readelf -sV /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | sed -n 's/.*@@GLIBCXX_//p' | sort -u -V | tail -1
3.4.17

I also have wheezy x64 and my libstdc++ is the same. I can confirm that recompiling fixes the problem.

any news?

I am having the same issue. (on Debian Wheezy x64)
I can't use bootstrap scss files which use sass map.
Since I am using webpack. I dig a bit into it to see where it come from (sass-loader & co) and it seems to come from node-sass.

Exemple

$grid-breakpoints: (
  xs: 0,
  sm: 544px,
  md: 768px,
  lg: 992px,
  xl: 1200px
) !default;
$container-max-widths: (
  sm: 576px,
  md: 720px,
  lg: 940px,
  xl: 1140px
) !default;



md5-77f6ae3887d1e7250c59befbbf22bc4f



node-sass   4.2.0   (Wrapper)   [JavaScript]
libsass     3.4.3   (Sass Compiler) [C/C++]
bootstrap   4.0.0-alpha.2

Working when recompiling

Confirmed. Following example ends in a segmentation fault (Debian Wheezy):

$colors: (
   white: (
       base: #ffffff
   )
);

Versions

node-sass   4.2.0   (Wrapper)   [JavaScript]
libsass     3.4.3   (Sass Compiler) [C/C++]

Wheezy is a known is issue. You'll need to recompile the binary locally.
We're looking into it.

On 13 Jan. 2017 7:44 pm, "Sven Henneboele" notifications@github.com wrote:

Confirmed. Following example ends in a segmentation fault (Debian Wheezy):

$colors: (
white: (
base: #ffffff
)
);

Versions

node-sass 4.2.0 (Wrapper) [JavaScript]
libsass 3.4.3 (Sass Compiler) [C/C++]

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1757#issuecomment-272390479,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWB-rkAVd831iouAC5keTUdC2fyfMks5rRzltgaJpZM4Kc7TR
.

You can try this:

cd node_modules/node-sass
node scripts/build -f

Rebuilding the script worked for me, I have the same problem on a debian wheezy x64 server with latest node-sass version.

Even if it's just a workaround, not a solution 😕

Sorry but, any news on this issue ?

No. For now your best bet is to compile the binary locally with npm rebuild node-sass

On 5 Apr. 2017 9:51 pm, "Loëck Vézien" notifications@github.com wrote:

Sorry but, any news on this issue ?

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1757#issuecomment-291837536,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWKKhnhbASbKDZksCoZQI5xSoiySOks5rs4A9gaJpZM4Kc7TR
.

npm rebuild did not solved the issue for me. Only @Pierstoval "workaround" worked.

For information, I am now deploying my app on Heroku, and I had to add
cd node_modules/node-sass && node scripts/build -f to my deploy script to make it work, just to say...

@xzyfer any news since April?
Having to rebuild the whole scripts slows the whole deploying and CI process 😕

Same problem here with a Docker container (Debian Jessie)

$ npm -v
3.10.10

$ node -v
v6.11.2

$ node -p process.versions
{ http_parser: '2.7.0',
  node: '6.11.2',
  v8: '5.1.281.103',
  uv: '1.11.0',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  icu: '56.1',
  modules: '48',
  openssl: '1.0.2l' }

$ node -p process.platform
linux

$ node -p process.arch
x64

$ npm ls node-sass
`-- [email protected]

$ node -p "require('node-sass').info"
node-sass   4.5.3   (Wrapper)   [JavaScript]
libsass     3.5.0.beta.2    (Sass Compiler) [C/C++]

$ sass --version
Sass 3.4.25 (Selective Steve)

But there is no problem with his Ubuntu 16.04 host

$ npm -v
3.10.10

$ node -v
v6.11.1

$ node -p process.versions
{ http_parser: '2.7.0',
  node: '6.11.1',
  v8: '5.1.281.103',
  uv: '1.11.0',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  icu: '56.1',
  modules: '48',
  openssl: '1.0.2k' }

$ node -p process.platform
linux

$ node -p process.arch
x64

$ npm ls node-sass
└── [email protected] 

$ node -p "require('node-sass').info"
node-sass   4.5.3   (Wrapper)   [JavaScript]
libsass     3.5.0.beta.2    (Sass Compiler) [C/C++]

$ sass --version
Sass 3.5.1 (Bleeding Edge)

The sass gem is different, could that causes the issue ?

Because here is the info about a different server we use to compile our assets (which has the seg fault) :

$ npm -v
3.10.10

$ node -v
v6.11.2

$ node -p process.versions
{ http_parser: '2.7.0',
  node: '6.11.2',
  v8: '5.1.281.103',
  uv: '1.11.0',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  icu: '56.1',
  modules: '48',
  openssl: '1.0.2l' }

$ node -p process.platform
linux

$ node -p process.arch
x64

$ npm ls node-sass
└── [email protected] 

$ node -p "require('node-sass').info"
node-sass   4.5.3   (Wrapper)   [JavaScript]
libsass     3.5.0.beta.2    (Sass Compiler) [C/C++]

$ sass --version
Sass 3.4.23 (Selective Steve)

Instead of npm rebuild node-sass as a workaround do you know if it's possible to downgrade to a previous version ?

@jeremy-richard you can always downgrade to a previous version if you need: https://stackoverflow.com/questions/15890958/how-do-i-install-a-previous-version-of-an-npm-package

@jeremy-richard are you using docker container based on Alpine Linux? If yes, your problem may be https://github.com/sass/node-sass/issues/2031, for which we do not have and we might not have fix (as this is the musl limitation it seems)

@Pierstoval thank you, but actually I can't downgrade because node-sass is a webpack3 sass-loader dependency and it require node-sass@^4.5.0

@saper yes it was, then I switch to debian:stretch and no problem with this one, thank you for the tip though.

Anyway I solve the problem by changing the base of my containers, but I keep an eye this issue.

FYI the issue still occurs with the debian:wheezy based containers.

Stale report, closing.

Was this page helpful?
0 / 5 - 0 ratings