Skip to content
Nilay Kabariya

Entry No.018·Fixes·Updated ·8 min read

"Cannot find native binding" in Vite 8: the missing @rolldown file

Vite 8 fails with "Cannot find native binding" and names @rolldown/binding-wasm32-wasi? That's a fallback, not your missing package. Both causes, and the fix.

What changed on Nov 9, 2026: Re-ran every case on Vite 8.3.7 (Rolldown 1.2.18), npm 11.19.1 and 12.2.2, Windows and Linux: all results held. Vite 8.3.7 asks for Rolldown ~1.2.18, not 1.3.

The error, verbatim

Jump to the fix ↓
Error: Cannot find native binding. npm has a bug related to optional dependencies
(https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing
both package-lock.json and node_modules directory.
    at file:///C:/project/node_modules/rolldown/dist/shared/binding-DPuPeV1X.mjs:603:34
  cause: Error: Cannot find module './rolldown-binding.win32-x64-msvc.node'
  cause: Error: Cannot find module '@rolldown/binding-win32-x64-msvc'
  cause: Error: Cannot find module './rolldown-binding.wasi.cjs'
  cause: Error: Cannot find module '@rolldown/binding-wasm32-wasi'

# the same project folder, built inside WSL:
  cause: Error: Cannot find module '@rolldown/binding-linux-x64-gnu'
  cause: Error: Cannot find module '../rolldown-binding.linux-x64-gnu.node'
✓ Reproduced on Windows 11 Pro

The fix that worked

Reinstall in the same folder:

npm i
Not it? Every cause, tested ↓

Tested on

Vite
8.3.0 (Rolldown 1.2.10)
npm
11.9.0
Node
24.14.0
OS
Windows 11 Pro
Also
Tailwind CSS 4.3.3 (oxide), Rspack 2.3.0, oxc-parser 0.156.0, rolldown 1.2.15 (October 29)
WSL
Ubuntu 24.04, Node 24.21.0
Re-tested
November 9: Vite 8.3.7, Rolldown 1.2.18, npm 11.19.1 and 12.2.2, Windows and Linux

✓ Last re-run on GitHub Actions · see the run · all repros

Vite 8 builds with Rolldown, which is written in Rust and ships as a separate compiled file for each operating system. This error means the file for your system isn’t in node_modules. The platform in the message changes (win32-x64-msvc, linux-x64-gnu, linux-x64-musl, darwin-arm64…), but the causes and the fix are the same everywhere.

The fix

In most cases, a plain install puts the missing file back. You don’t need to delete anything first:

npm i

If the error comes straight back after that, npm has been told to skip optional packages. Check:

npm config get omit

If it prints optional, that’s the cause. Remove omit=optional from the .npmrc it came from (the project’s, or your user-level one), then run npm i again.

The same message from Tailwind CSS 4, Rspack and oxc

The wording comes from napi-rs, the tool many Rust-based npm packages are built with, so it isn’t only Vite’s error. I installed several of them on Windows, removed each one’s platform package, and loaded it:

Package Message Platform package on Windows x64
rolldown 1.2.15 (Vite 8) “Cannot find native binding. npm has a bug…” @rolldown/binding-win32-x64-msvc
@tailwindcss/oxide 4.3.3 (Tailwind CSS 4) “Cannot find native binding. npm has a bug…” @tailwindcss/oxide-win32-x64-msvc
@rspack/core 2.3.0 “Cannot find native binding. npm has a bug…” @rspack/binding-win32-x64-msvc
oxc-parser 0.156.0 “Cannot find native binding. npm has a bug…” @oxc-parser/binding-win32-x64-msvc
lightningcss Cannot find module '../lightningcss.win32-x64-msvc.node' lightningcss-win32-x64-msvc
@parcel/watcher 2.6.0 “No prebuild or local build of @parcel/watcher found” @parcel/watcher-win32-x64

The cause: line at the bottom is often the last fallback the loader tried, such as @rolldown/binding-wasm32-wasi or @oxc-parser/binding-wasm32-wasip1, not the package you’re missing. Look for the one with your platform in its name.

The fix is the same for all of them: run npm i in the project folder, so npm puts the missing platform package back.

What actually causes it

The error message blames an npm bug. In my tests, the missing file had two ordinary causes, and neither was that bug:

1. Optional packages were skipped

Rolldown lists its per-platform files as optional dependencies, so npm installs only the one matching your machine. Anything that tells npm to skip optional packages removes it:

  • npm install --omit=optional
  • omit=optional in .npmrc

After npm i --omit=optional, the @rolldown folder held pluginutils and nothing else, and the build failed with exactly the error above.

2. node_modules came from another operating system

node_modules is not portable between operating systems. I installed the project as if on Linux, then ran it on Windows:

node_modules/@rolldown/binding-linux-x64-gnu     <- present
node_modules/@rolldown/binding-win32-x64-msvc    <- missing

Same error. This is what happens when node_modules is copied from WSL, a Docker container, a Mac, or a teammate’s machine, or when a Docker bind mount shares the host’s node_modules with a container.

Windows and WSL sharing one project folder

This is the most common way to meet the Linux version of the error. You install on Windows, then open the same folder in WSL (under /mnt/c/…) and build there:

cause: Error: Cannot find module '@rolldown/binding-linux-x64-gnu'
cause: Error: Cannot find module '../rolldown-binding.linux-x64-gnu.node'

The Windows install only fetched the Windows binding. WSL runs Linux, so it looks for the Linux one.

Best: one install per system. Keep a separate copy of the project inside WSL’s own filesystem (for example ~/my-app, not /mnt/c/...) and run npm i there. It gets the Linux binding, and your Windows folder keeps the Windows one.

If you really need one folder for both, add the other system’s binding yourself, at exactly the Rolldown version you have. Check the version first:

npm ls rolldown

Then, on Windows, with that version (1.2.11 in my test):

npm i -D @rolldown/binding-linux-x64-gnu@1.2.11 --force

About the npm bug the message mentions

The message points to npm/cli#4828, a long-standing issue where a lockfile created on one platform could leave out other platforms’ optional packages. I tried to trigger it: I created package-lock.json for Linux, deleted node_modules, and ran npm ci on Windows.

On npm 11.9.0 it installed the correct Windows binding and the build passed. So on current npm, the lockfile alone didn’t cause this. That’s why deleting package-lock.json, as the message suggests, is usually more than you need: it works, but it also unpins every dependency version in your project.

Vite 5 to 7 hit the same thing through Rollup, with Cannot find module @rollup/rollup-linux-x64-gnu; lockfiles from three OSes and the setups that do cause it are in that post.

The binding name for your system

The message names the package for the machine it ran on. These are the ones Rolldown 1.2.10 ships:

System Package
Windows x64 @rolldown/binding-win32-x64-msvc
Windows ARM @rolldown/binding-win32-arm64-msvc
macOS Apple Silicon @rolldown/binding-darwin-arm64
macOS Intel @rolldown/binding-darwin-x64
Linux x64 (Ubuntu, Debian…) @rolldown/binding-linux-x64-gnu
Linux x64, Alpine (Docker) @rolldown/binding-linux-x64-musl
Linux ARM64 @rolldown/binding-linux-arm64-gnu / -musl

The gnu and musl pair matters in Docker: Alpine images use musl, most other Linux systems use gnu, so a node_modules built on one won’t have the file the other looks for.

What didn’t work

If deleting node_modules for the fix fails on Windows with EBUSY or EPERM, something still holds a file in it: EBUSY: resource busy or locked, tested. And if the build passes but the browser says process is not defined, see that fix for Vite.

How this was tested

A fresh Vite 8.3.0 project (Rolldown 1.2.10) on Windows 11 with Node 24.14.0 and npm 11.9.0. The binding was removed three ways: --omit=optional, a Linux-targeted install (--os=linux --cpu=x64 --libc=glibc) run on Windows, and omit=optional in a project .npmrc. The fixes were then run against those broken states, and npm ci was tried with a Linux-made lockfile. The Windows and WSL section was tested on September 29 with Vite 8.3.1 (Rolldown 1.2.11): installed from Windows, then built in WSL Ubuntu 24.04 with its own Linux Node 24.21.0, in the same folder and in a separate copy in the WSL home. Every error and every result above is the real output.

The other packages were tested on October 29, 2026, in one project on the same machine: each platform package was moved out of node_modules, the package was loaded with require(), and then npm i was run. The script and its full output are public.

November 2, 2026: re-run on GitHub Actions (windows-latest and ubuntu-latest, Node 24.22.1) with Vite 8.3.5 and Rolldown 1.2.16. With the binding folder removed, the build failed with the same “Cannot find native binding” message, npm rebuild didn’t help, and npm i with package-lock.json kept fixed it. omit=optional in .npmrc broke a fresh install the same way, and removing it fixed it. The same held on npm 12.2.1. The script and output are public.

November 6, 2026: re-run on the same runners with Vite 8.3.6 (still Rolldown 1.2.16), Node 24.22.2, npm 11.19.1 and npm 12.2.2. Every result held on both systems: removing the binding folder gave the same “Cannot find native binding” error, npm rebuild didn’t help, npm i with the lockfile kept put the binding back and the build passed, omit=optional produced the error until the line was removed, and npm 12 behaved the same as npm 11. I also read Rolldown 1.2.16’s loader: it tries the native file for your platform first and only then the wasm32-wasi build, which is why that package shows up last in the error. The run.

November 9, 2026: re-run on the same runners with Vite 8.3.7, which installs Rolldown 1.2.18. Rolldown 1.3.0 and 1.3.1 are out on npm, but Vite 8.3.7 depends on rolldown ~1.2.18, so a fresh install still got 1.2.18. Every result held on Windows and Linux, on npm 11.19.1 and 12.2.2: the same error with the binding folder removed, no help from npm rebuild, the binding restored by npm i with the lockfile kept, and omit=optional failing until the line was removed. The run.

— N.K., end of entry No.018

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.108

    sh: vite: command not found on Linux, macOS, CI and Docker

    sh: vite: command not found in CI, Docker or a Linux shell: six causes tested on Ubuntu and macOS, the exact message each one prints, and which fix worked.

    > > vite build

    FIXED4 min
  2. No.093

    Fix: bigint Failed to load bindings, pure JS will be used

    bigint: Failed to load bindings, pure JS will be used. Why npm 12 shows it on every install, whether it matters, and how to get the native build back.

    > bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)

    FIXED3 minWindows
  3. No.072

    npm error code ENOENT, and spawn npx ENOENT on Windows

    Read the path line first. On Windows, spawn npx ENOENT has a twist: adding .cmd now fails with EINVAL. Four ENOENT causes reproduced, each with its fix.

    > npm error code ENOENT

    FIXED3 minWindows

tip: paste the exact error text