node-sass preventing node from exiting

Created on 9 May 2019  ·  4Comments  ·  Source: sass/node-sass

  • NPM version (npm -v): 6.9.0
  • Node version (node -v): v12.1.0 and v10.15.3 tested
  • Node Process (node -p process.versions):
{
  node: '12.1.0',
  v8: '7.4.288.21-node.16',
  uv: '1.28.0',
  zlib: '1.2.11',
  brotli: '1.0.7',
  ares: '1.15.0',
  modules: '72',
  nghttp2: '1.38.0',
  napi: '4',
  llhttp: '1.1.1',
  http_parser: '2.8.0',
  openssl: '1.1.1b',
  cldr: '35.1',
  icu: '64.2',
  tz: '2019a',
  unicode: '12.1'
}
  • Node Platform (node -p process.platform): darwin (Mac OS X 10.14.3)
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
node-sass   4.12.0  (Wrapper)   [JavaScript]
libsass     3.5.4   (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass):
[email protected] .../node-sass-hangs
└── [email protected]

I noticed that webpack builds of our project froze node without exiting if a JS error was encountered during the bundling. Manually calling process.exit() didn't work either. Debugging pointed towards node-sass being the culprit as the process exited when removing all scss imports from the webpack build. I've only been able to repro the issue when including most of the codebase, making it hard to create a minimal example.

Instead I found a similar issue with the same symptom with an example I was able to reproduce myself: https://github.com/nodejs/node/issues/17872

Updated reproducible minimal example that should work with both node v12.1.0 and v10.*.

Help much appreciated!

API - Custom Importers Invalid - Duplicate Module - Binding

All 4 comments

First problem is that you never return from the importer properly. But even if you would do, it still hangs.

process.exit() is running while there are other things scheduled in the event loop. This is special with node-sass since we jump to native code and return to JavaScript as we need (for example for importers).

After some reading of the code this looks as a duplicate of https://github.com/sass/node-sass/issues/1048 to me

Looking at my proposed solutions at https://github.com/sass/node-sass/issues/857#issuecomment-93594360 I'd suggest bumping priority of https://github.com/sass/libsass/issues/1108 with libsass developers... (as per https://github.com/sass/libsass/issues/1892#issue-128067430)

Closing in favour of #1048

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tjistooshort picture tjistooshort  ·  4Comments

Pixelatex picture Pixelatex  ·  3Comments

paulcpederson picture paulcpederson  ·  3Comments

primiano picture primiano  ·  3Comments

mkbctrl picture mkbctrl  ·  4Comments