embedded-host-node icon indicating copy to clipboard operation
embedded-host-node copied to clipboard

EPIPE on Mac (Apple Silicon)

Open brotheroftux opened this issue 4 months ago • 7 comments

When using sass-loader with sass-embedded in rspack, I get the following error:

> RSPACK_CONFIG_VALIDATE=loose rspack build

node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:962:11)
    at Socket._write (node:net:974:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at AsyncCompiler.writeStdin ((omitted for privacy)/node_modules/sass-embedded/dist/lib/src/compiler/async.js:60:28)
    at PacketTransformer.writeInboundBuffer ((omitted for privacy)/node_modules/sass-embedded/dist/lib/src/compiler/async.js:114:18)
    at PacketTransformer.writeInboundProtobuf ((omitted for privacy)/node_modules/sass-embedded/dist/lib/src/packet-transformer.js:68:18)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v18.20.3

Loader configuration:

{
    loader: 'sass-loader',
    options: {
        api: 'modern-compiler',
        implementation: require.resolve('sass-embedded'),
        sassOptions: {
            logger: console,
            includePaths: [
                injectable('styles'),
                src('styles'),
                src('.'),
            ],
        },
    },
},
    "sass-embedded": "^1.89.2",
    "sass-loader": "^16.0.5",

Honestly not sure what to do. Any help would be appreciated.

brotheroftux avatar Jul 11 '25 23:07 brotheroftux

It looks like the embedded compiler has closed suddenly and not gracefully. We could add more error handling for this, but it would only result in producing a more legible error message saying something like "The embedded compiler catastrophically failed", so I'm not sure it's worth obscuring the actual failure.

Can you reproduce this with just the embedded Sass API, without rspack involved?

nex3 avatar Jul 14 '25 21:07 nex3

It looks like the embedded compiler has closed suddenly and not gracefully. We could add more error handling for this, but it would only result in producing a more legible error message saying something like "The embedded compiler catastrophically failed", so I'm not sure it's worth obscuring the actual failure.

Can you reproduce this with just the embedded Sass API, without rspack involved?

Could you please provide some ideas on how could I try to reproduce this without involving rspack?

brotheroftux avatar Jul 15 '25 18:07 brotheroftux

The documentation for the Sass JS API is here. If just using the API on its own isn't enough, you may need to work with the rspack maintainers to try to find a minimal version of whatever importer or API pattern they're using that's triggering this.

nex3 avatar Jul 15 '25 20:07 nex3

same

ynode:events:502
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:159:15)
    at writeGeneric (node:internal/stream_base_commons:150:3)
    at Socket._writeGeneric (node:net:971:11)
    at Socket._write (node:net:983:8)
    at writeOrBuffer (node:internal/streams/writable:572:12)
    at _write (node:internal/streams/writable:501:10)
    at Writable.write (node:internal/streams/writable:510:10)
    at AsyncCompiler.writeStdin......
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v22.13.1

in webpack

"sass-embedded": "^1.90.0",
"react-scripts": "^5.0.1",
"@craco/craco": "^7.1.0",

SolidZORO avatar Aug 22 '25 07:08 SolidZORO

Can you please run the following command and check the output?

node ./node_modules/sass-embedded/dist/bin/sass.js --version

It should just print 1.90.0 on macOS.

If you are seeing 1.90.0 compiled with dart2js 3.8.3 or getting an error, tell us what you're seeing. Most likely you're missing an optional dependency, which is supposed to be installed automatically in normal cases.

ntkme avatar Aug 22 '25 16:08 ntkme

@ntkme

$ node ./node_modules/sass-embedded/dist/bin/sass.js --version 1.90.0

here is my macOS output.

the error I mentioned above only happened once, and my Sass can compile CSS normally.

same

ynode:events:502 throw er; // Unhandled 'error' event ^

Error: write EPIPE at afterWriteDispatched (node:internal/stream_base_commons:159:15) at writeGeneric (node:internal/stream_base_commons:150:3) at Socket._writeGeneric (node:net:971:11) at Socket._write (node:net:983:8) at writeOrBuffer (node:internal/streams/writable:572:12) at _write (node:internal/streams/writable:501:10) at Writable.write (node:internal/streams/writable:510:10) at AsyncCompiler.writeStdin...... at process.processTicksAndRejections (node:internal/process/task_queues:105:5) Emitted 'error' event on Socket instance at: at emitErrorNT (node:internal/streams/destroy:170:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3) at process.processTicksAndRejections (node:internal/process/task_queues:90:21) { errno: -32, code: 'EPIPE', syscall: 'write' }

Node.js v22.13.1 in webpack 在 webpack 中

"sass-embedded": "^1.90.0", "react-scripts": "^5.0.1", "@craco/craco": "^7.1.0",

SolidZORO avatar Aug 22 '25 16:08 SolidZORO

the error I mentioned above only happened once, and my Sass can compile CSS normally.

The error means the dart-sass compiler somehow crashed unexpectedly. If it only happened once there isn't much we can do, unless someone discovers a way to reliably reproduce the crash.

ntkme avatar Aug 22 '25 16:08 ntkme