Error running Nodejs projects that depend on the `sass-embedded` npm package

Hi guys, I have a node project which breaks when I run the development server and the issue seems to be sass-embedded , but I don’t know why it happens. I’m using direnv and flakes to build the dev environment and here’s how it looks like:

{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";

    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, rust-overlay }: let
    system = "x86_64-linux";

    overlays = [ (import rust-overlay) ];

    pkgs = import nixpkgs {
      inherit system overlays;
    };

    rustBin = pkgs.pkgsBuildHost.rust-bin;
    rustPkg = rustBin.fromRustupToolchainFile
      ./rust-toolchain.toml;

  in {
    devShell.${system} = with pkgs; mkShell {
      nativeBuildInputs = [
        pkg-config
        gobject-introspection
        rustPkg
        cargo-tauri
        cargo-outdated

        pnpm
        nodejs-slim_24
        typescript-language-server
      ];

      buildInputs = [
        dart-sass
        webkitgtk_4_1
        openssl
        pango
        libsoup_3
        librsvg
        harfbuzz
        gtk3
        glib
        gdk-pixbuf
        cairo
        atkmm
        at-spi2-atk

        xdo
        xdotool
      ];

      SASS_EMBEDDED_BIN_PATH = "${pkgs.dart-sass}/bin/sass";
    };
  };
}

But when I try to run it I get Error: write EPIPE error, and I have this same issue with other projects that also depend on sass-embedded I’m attaching a picture with the error in question

I have the same error using devenv for a Vue + Quasar project:

{ pkgs, lib, config, inputs, ... }:

{
    languages = {
        java = {
            enable = true;
            gradle.enable = true;
        };

        javascript = {
            enable = true;
            directory = "./frontend";
            npm = {
                enable = true;
                install.enable = true;
            };
        };

        typescript = {
            enable = true;
        };
    };

    cachix.enable = false;
}

I haven’t been able to fix the issue, so my solution for now was simply to move to Arch Linux. I’d love to understand why this happens, though

Sorry for you then! In most cases, this kind of issue happens because the underlying package manager (e.g., npm) tries to download prebuilt binaries and run them “as-is” on your machine.

On NixOS, this approach doesn’t work. You can’t just run arbitrary prebuilt binaries. You have 2 options:

  • Either you fully know and understand your dependency tree and provide the required dependencies explicitly,
  • Or you let the package manager try to fetch and run them, and it will likely fail.

There are workarounds (e.g., nix-ld can help in some cases), but the most reliable solution is to avoid relying on auto-downloaded binaries altogether. Instead, make sure all dependencies are declared and available in your environment so that Node doesn’t attempt to fetch them at runtime.

1 Like