Skip to content

[2.0.0-rc.13] @solidjs/compiler-wasm32-wasi failed to load when root directory is not accessible by user (e.g. Android Termux) #3748

Closed

Description

@lingbopro

Describe the bug

When starting a Solid.js 2.0.0-rc project on Android and opening it in a browser, there will be a fatal error:

[plugin:solid] @solidjs/vite-plugin: failed to load @solidjs/compiler, which is required in every mode (it drives the lazy, refresh, and server-function transforms; compiler: "babel" only switches the JSX transform). Your platform should get a prebuilt native binary or the @solidjs/compiler-wasm32-wasi fallback — check that optional dependencies were installed.

Cause: UVWASI_EACCES, uvwasi_init
virtual:solid-ssr-entry-server.tsx
    at loadNativeCompiler (file:///data/data/com.termux/files/home/dev/solid-starter-app/solid-starter-app/node_modules/.pnpm/@solidjs+vite-plugin@3.0.0-next.46_@solidjs+start-devtools@1.0.0-next.5_@solidjs+web@2._4dfd9c0f240268de2f4a0baea2fe3f37/node_modules/@solidjs/vite-plugin/dist/esm/index.mjs:3783:11)
    at async TransformPluginContext.transform (file:///data/data/com.termux/files/home/dev/solid-starter-app/solid-starter-app/node_modules/.pnpm/@solidjs+vite-plugin@3.0.0-next.46_@solidjs+start-devtools@1.0.0-next.5_@solidjs+web@2._4dfd9c0f240268de2f4a0baea2fe3f37/node_modules/@solidjs/vite-plugin/dist/esm/index.mjs:5075:24)
    at async EnvironmentPluginContainer.transform (file:///data/data/com.termux/files/home/dev/solid-starter-app/solid-starter-app/node_modules/.pnpm/vite@8.3.0_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:8172:14)
    at async loadAndTransform (file:///data/data/com.termux/files/home/dev/solid-starter-app/solid-starter-app/node_modules/.pnpm/vite@8.3.0_jiti@2.7.0/node_modules/vite/dist/node/chunks/node.js:19634:26)

Your Example Website or App

This is NOT reproducible on Stackblitz because it require special environments. See the "Additional context" field below.

Steps to Reproduce the Bug or Issue

On Android (or other platforms where @solidjs/compiler do not have native bindings and the root directory is not accessible by user), create a Solid app and select 2.0.0-rc when prompted.

Then go into the project directory, run pnpm install then pnpm dev. Open the link in the browser and the error will be shown in the browser tab and the terminal.

Expected behavior

The app should successfully start and run normally in the browser.

Screenshots or Videos

Image

Also see below.

Platform

  • OS: Android
  • Browser: Edge

Additional context

This is because @solidjs/compiler failed to import the WASM bindings (https://github.com/solidjs/solid/blob/9a213bbb514ca313bdefc5bfe33d072e94409c65/packages/compiler/index.js#L429-436)

(The following reproducing steps should be done in Termux.)

by manually importing the WASM bindings (node -p "require('@solidjs/compiler-wasm32-wasi')", if using pnpm you'll need to cd node_modules/.pnpm/@solidjs+compiler@2.0.0-rc.10 first), we can know that the WASM binding library returned an error:

    const wrap = new _WASI(args, env, preopens, stdio);
                 ^

Error: UVWASI_EACCES, uvwasi_init
    at new WASI (node:wasi:90:18)
    at Object.<anonymous> (/data/data/com.termux/files/home/dev/solid-starter-app/solid-starter-app/node_modules/.pnpm/@solidjs+compiler-wasm32-wasi@2.0.0-rc.10/node_modules/@solidjs/compiler-wasm32-wasi/compiler.wasi.cjs:111:16)
    at Module._compile (node:internal/modules/cjs/loader:1944:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:2084:10)
    at Module.load (node:internal/modules/cjs/loader:1666:32)
    at Module._load (node:internal/modules/cjs/loader:1447:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:260:19)
    at Module.require (node:internal/modules/cjs/loader:1689:12)
    at require (node:internal/modules/helpers:191:16)
    at [eval]:1:1 {
  errno: 2,
  code: 'UVWASI_EACCES',
  syscall: 'uvwasi_init'
}

Here's what caused the error in compiler.wasi.cjs (line 109-117):

const __rootDir = __nodePath.parse(process.cwd()).root

const __wasi = new __nodeWASI({
  version: 'preview1',
  env: process.env,
  preopens: {
    [__rootDir]: __rootDir,
  }
})

So we can create a minimal reproducing code:

const path = require('node:path');
const { WASI } = require('node:wasi');
const __rootDir = path.parse(process.cwd()).root;
const wasi = new WASI({
  version: 'preview1',
  env: process.env,
  preopens: {
    [__rootDir]: __rootDir,
  }
});

The problem is that __rootDir is / (the root directory), which is not accessible by user in Android, making uvwasi to throw a UVWASI_EACCES error. We can confirm this by replacing __rootDir with '/data/data/com.termux/files/home' (which is Termux home directory, accessible by user) in the reproducing code and the code will work.

So is this a bug by Solid.js? And will there be a fix or workaround?

Activity

  1. added a commit that references this issue on Oct 2, 2026
    41be120
  2. ryansolid commented on Oct 2, 2026

    @ryansolid
    Member

    Fixed in #3758 (41be120), which will ship in the next RC.

    The @solidjs/compiler-wasm32-wasi loader is generated by napi-rs, and the version we built with preopened the filesystem root /. That root can't be opened on Android, so the loader failed with UVWASI_EACCES. The fix bumps @napi-rs/cli, which picks up the upstream fix (napi-rs/napi-rs#3485, released in 3.9.1). On Android, the regenerated loader maps the WASI root to the current working directory, and other platforms are unchanged.

    A regression test simulates the Termux restriction, but we couldn't test on a real Termux device. If it still fails for you after the next release, please report back here.

    — Claude via Cursor

  3. added a commit that references this issue on Oct 4, 2026
    1b9ceb6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions