Skip to content
Latchkey

How to Fix node-sass (and Migrate to sass) in CI

node-sass is deprecated and brittle in CI because it downloads a platform-specific binary at install time. The real fix is to stop using it.

node-sass (LibSass) fetches a prebuilt binary per Node version and platform; a mismatch or a failed download breaks the install. The pure-JS sass (Dart Sass) package is the maintained replacement.

Why it fails in CI

  • No prebuilt binary for your Node version → Node Sass does not yet support your current environment.
  • The binary download from GitHub releases times out or is rate-limited.
  • A node_modules cached on another Node version carries an incompatible binary.

Install it reliably

Migrate to sass (Dart Sass), which is pure JavaScript and needs no native binary. Its API is largely compatible for compilation.

Terminal
# replace node-sass with the maintained pure-JS package
npm uninstall node-sass
npm install --save-dev sass

# if you must keep node-sass, pin a version that supports your Node
# and ensure the binary download is not blocked/rate-limited

Cache & speed

With sass, there is no binary to download - just normal npm caching. If you stay on node-sass, cache its binary directory keyed on Node version to avoid re-downloading.

.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: ~/.npm
    key: npm-${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}

Common errors

  • Node Sass does not yet support your current environment → Node/binary mismatch; migrate to sass.
  • Missing binding .../binding.node → the binary did not install; reinstall or migrate.
  • Download ETIMEDOUT/403 fetching the binary → transient/registry issue; migrate to remove the dependency.

Key takeaways

  • node-sass is deprecated and downloads a fragile per-platform binary.
  • Migrate to the pure-JS sass (Dart Sass) package to remove the failure mode entirely.
  • Most build tooling supports sass as a direct swap.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →