Skip to content

vite-plus fails to resolve native binding @voidzero-dev/vite-plus-linux-x64-musl when installed with Bun in Docker (Alpine/musl) #992

@xinyao27

Description

@xinyao27

Describe the bug

Environment

  • Runtime: Bun v1.3.10
  • Platform: Docker (Linux x64, musl libc — likely Alpine-based)
  • VitePlus: v0.1.12
  • Node.js: v22.22.0

Problem

vp build crashes immediately with:

Error: Cannot find native binding.
[cause]: Cannot find module '@voidzero-dev/vite-plus-linux-x64-musl'

The optional dependency @voidzero-dev/vite-plus-linux-x64-musl is not installed despite bun install completing successfully with all 611 packages
resolved.

Reproduction

In a Docker container (Alpine/musl-based)

rm -f bun.lock package-lock.json
bun install # succeeds, no errors
bun run build # runs tsc && vp build → crashes

Analysis

Bun has a known issue with optional dependencies (npm/cli#4828 referenced in the error message). The platform-specific native
binding package for linux-x64-musl is declared as an optionalDependency but Bun silently skips it without warning during install, causing a runtime
crash.

Expected Behavior

Either:

  1. VitePlus should provide a fallback (e.g., WASM) when the native binding is unavailable, or
  2. The linux-x64-musl binding should be listed in a way that Bun correctly resolves it (e.g., via overrides or explicit platform mapping)

Error logs:

RUN cd src/web-chat-react && rm -f bun.lock package-lock.json && bun install && bun run build
8s
bun install v1.3.10 (30e609e0)
Resolving dependencies
Resolved, downloaded and extracted [2356]
Saved lockfile
+ @types/react@19.2.14
+ @types/react-dom@19.2.3
+ typescript@5.9.3
+ vite@0.1.12
+ vite-plus@0.1.12
+ @base-ui/react@1.3.0
+ @fontsource-variable/inter@5.2.8
+ @phosphor-icons/react@2.1.10
+ @streamdown/code@1.1.0
+ @tailwindcss/vite@4.2.1
+ class-variance-authority@0.7.1
+ clsx@2.1.1
+ cmdk@1.1.1
+ date-fns@4.1.0
+ embla-carousel-react@8.6.0
+ input-otp@1.4.2
+ next-themes@0.4.6
+ react-day-picker@9.14.0
+ react-resizable-panels@4.7.3
+ recharts@2.15.4 (v3.8.0 available)
+ shadcn@4.0.8
+ sonner@2.0.7
+ streamdown@2.4.0
+ tailwind-merge@3.5.0
+ tailwindcss@4.2.1
+ tw-animate-css@1.4.0
+ vaul@1.1.2
611 packages installed [3.72s]
$ tsc && vp build
/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs:748
    throw new Error(
          ^
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 Object.<anonymous> (/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs:748:11)
    at Module._compile (node:internal/modules/cjs/loader:1706:14)
    at Object..js (node:internal/modules/cjs/loader:1839:10)
    at Module.load (node:internal/modules/cjs/loader:1441:32)
    at Function._load (node:internal/modules/cjs/loader:1263:12)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
    at cjsLoader (node:internal/modules/esm/translators:309:5)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:343:25) {
  [cause]: Error: Cannot find module '@voidzero-dev/vite-plus-linux-x64-musl'
  Require stack:
  - /app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs
      at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
      ... 6 lines matching cause stack trace ...
      at require (node:internal/modules/helpers:147:16)
      at requireNative (/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs:354:27)
      at Object.<anonymous> (/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs:715:17) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs'
    ],
    cause: Error: Cannot find module './vite-plus.linux-x64-musl.node'
    Require stack:
    - /app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs
        at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
        at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
        at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
        at Function._load (node:internal/modules/cjs/loader:1192:37)
        at TracingChannel.traceSync (node:diagnostics_channel:328:14)
        at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
        at Module.require (node:internal/modules/cjs/loader:1463:12)
        at require (node:internal/modules/helpers:147:16)
        at requireNative (/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs:349:18)
        at Object.<anonymous> (/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs:715:17) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        '/app/src/web-chat-react/node_modules/vite-plus/binding/index.cjs'
      ]
    }
  }
}
Node.js v22.22.0
error: script "build" exited with code 1

Reproduction

https://gist.github.com/xinyao27/2326b75809373ae946092486b14899de

Steps to reproduce

No response

System Info

VITE+ - The Unified Toolchain for the Web

Environment:
  Version  24.14.0
  Source   lts

Tool Paths:
  node  /Users/chenyueban/.vite-plus/js_runtime/node/24.14.0/bin/node
  npm   /Users/chenyueban/.vite-plus/js_runtime/node/24.14.0/bin/npm
  npx   /Users/chenyueban/.vite-plus/js_runtime/node/24.14.0/bin/npx

Used Package Manager

bun

Logs

Validations

Metadata

Metadata

Labels

No labels
No labels

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions