S
SolidJSā€¢3mo ago
Industrial

Using WASM in Solid(Start)

Hi. I have a SolidStart app that I'm running with Bun and what I want to do is embed WASM code into my solid app. https://github.com/Industrial/skeleton-nodejs/blob/main/applications/solid-app/src/test.ts This is an example of loading the WASM code (Haskell) and running a function. When I try to add that code to the https://github.com/Industrial/skeleton-nodejs/blob/main/applications/solid-app/src/app.tsx then I get the error:
Error: Cannot find module @rollup/rollup-linux-x64-musl. 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 requireWithFriendlyError (/run/media/tom/Data/Code/skeleton-nodejs/node_modules/vite/node_modules/rollup/dist/native.js:59:9)
at Object.<anonymous> (/run/media/tom/Data/Code/skeleton-nodejs/node_modules/vite/node_modules/rollup/dist/native.js:68:76)
...snip...
[cause]: Error: Dynamic loading not supported
at Module._extensions..node (node:internal/modules/cjs/loader:1614:18)
...snip...
code: 'ERR_DLOPEN_FAILED'
}
}
Error: Cannot find module @rollup/rollup-linux-x64-musl. 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 requireWithFriendlyError (/run/media/tom/Data/Code/skeleton-nodejs/node_modules/vite/node_modules/rollup/dist/native.js:59:9)
at Object.<anonymous> (/run/media/tom/Data/Code/skeleton-nodejs/node_modules/vite/node_modules/rollup/dist/native.js:68:76)
...snip...
[cause]: Error: Dynamic loading not supported
at Module._extensions..node (node:internal/modules/cjs/loader:1614:18)
...snip...
code: 'ERR_DLOPEN_FAILED'
}
}
4 Replies
Industrial
IndustrialOPā€¢3mo ago
I tried manually adding that package with bun add -D but get the same error. Is there an official way of running WASM code in a SolidJS app?
Madaxen86
Madaxen86ā€¢3mo ago
There are some issues with bun and solid. Maybe you can try to use node and check if it still errors.
Industrial
IndustrialOPā€¢3mo ago
Let me try šŸ™‚ Hmm, I get this: solid-app on ī‚  main [!+?] via .NET via īœ˜ v22.5.1 via ā„ļø impure (nix-shell-env) took 15s āÆ npm install @rollup/rollup-linux-x64-musl npm error code EBADPLATFORM npm error notsup Unsupported platform for @rollup/[email protected]: wanted {"os":"linux","cpu":"x64","libc":"musl"} (current: {"os":"linux","cpu":"x64","libc":null}) npm error notsup Valid os: linux npm error notsup Actual os: linux npm error notsup Valid cpu: x64 npm error notsup Actual cpu: x64 npm error notsup Valid libc: musl npm error notsup Actual libc: null npm error A complete log of this run can be found in: /home/tom/.npm/_logs/2024-08-25T11_17_56_304Z-debug-0.log
ā–—ā–„ā–„ā–„ ā–—ā–„ā–„ā–„ā–„ ā–„ā–„ā–„ā–– tom@huginn
ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–ˆā–› ----------
ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ā–Ÿā–ˆā–ˆā–ˆā–› OS: NixOS 24.11.20240823.ae815ce (Vicuna) x86_64
ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› Host: StarLite (1.0)
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–› ā–Ÿā–™ Kernel: Linux 6.6.46
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–™ Uptime: 6 days, 11 hours, 15 mins
ā–„ā–„ā–„ā–„ā–– ā–œā–ˆā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–ˆā–› Packages: 1729 (nix-system)
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–ˆā–› Shell: fish 3.7.1
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–› ā–Ÿā–ˆā–ˆā–ˆā–› Display (BOE0B36): 2160x1440 @ 60 Hz in 13ā€³ [Built-in]
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ DE: GNOME 46.4
ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› WM: Mutter (Wayland)
ā–Ÿā–ˆā–ˆā–ˆā–› ā–Ÿā–™ ā–Ÿā–ˆā–ˆā–ˆā–› WM Theme: Adwaita
ā–Ÿā–ˆā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–ˆā–› Theme: Adwaita [GTK2/3/4]
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–ˆā–ˆā–ˆā–™ ā–ā–€ā–€ā–€ā–€ Icons: Adwaita [GTK2/3/4]
ā–œā–ˆā–ˆā–› ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› Font: Cantarell (11pt) [GTK2/3/4]
ā–œā–› ā–Ÿā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› Cursor: Adwaita (24px)
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ Terminal: code 1.90.1
ā–Ÿā–ˆā–ˆā–ˆā–›ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ CPU: Intel(R) N200 (4) @ 3,70 GHz
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ GPU: Intel UHD Graphics @ 0,75 GHz [Integrated]
ā–ā–€ā–€ā–€ ā–€ā–€ā–€ā–€ā–˜ ā–€ā–€ā–€ā–˜ Memory: 9,47 GiB / 15,47 GiB (61%)
Swap: Disabled
Disk (/): 93,55 GiB / 467,87 GiB (20%) - ext4
Disk (/run/media/tom/Data): 909,57 MiB / 937,62 GiB (0%) - ext4
ā–—ā–„ā–„ā–„ ā–—ā–„ā–„ā–„ā–„ ā–„ā–„ā–„ā–– tom@huginn
ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–ˆā–› ----------
ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ā–Ÿā–ˆā–ˆā–ˆā–› OS: NixOS 24.11.20240823.ae815ce (Vicuna) x86_64
ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› Host: StarLite (1.0)
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–› ā–Ÿā–™ Kernel: Linux 6.6.46
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–™ Uptime: 6 days, 11 hours, 15 mins
ā–„ā–„ā–„ā–„ā–– ā–œā–ˆā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–ˆā–› Packages: 1729 (nix-system)
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–ˆā–› Shell: fish 3.7.1
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–› ā–Ÿā–ˆā–ˆā–ˆā–› Display (BOE0B36): 2160x1440 @ 60 Hz in 13ā€³ [Built-in]
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ DE: GNOME 46.4
ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› WM: Mutter (Wayland)
ā–Ÿā–ˆā–ˆā–ˆā–› ā–Ÿā–™ ā–Ÿā–ˆā–ˆā–ˆā–› WM Theme: Adwaita
ā–Ÿā–ˆā–ˆā–ˆā–› ā–Ÿā–ˆā–ˆā–™ ā–Ÿā–ˆā–ˆā–ˆā–› Theme: Adwaita [GTK2/3/4]
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–ˆā–ˆā–ˆā–™ ā–ā–€ā–€ā–€ā–€ Icons: Adwaita [GTK2/3/4]
ā–œā–ˆā–ˆā–› ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› Font: Cantarell (11pt) [GTK2/3/4]
ā–œā–› ā–Ÿā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–› Cursor: Adwaita (24px)
ā–Ÿā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ Terminal: code 1.90.1
ā–Ÿā–ˆā–ˆā–ˆā–›ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ CPU: Intel(R) N200 (4) @ 3,70 GHz
ā–Ÿā–ˆā–ˆā–ˆā–› ā–œā–ˆā–ˆā–ˆā–™ ā–œā–ˆā–ˆā–ˆā–™ GPU: Intel UHD Graphics @ 0,75 GHz [Integrated]
ā–ā–€ā–€ā–€ ā–€ā–€ā–€ā–€ā–˜ ā–€ā–€ā–€ā–˜ Memory: 9,47 GiB / 15,47 GiB (61%)
Swap: Disabled
Disk (/): 93,55 GiB / 467,87 GiB (20%) - ext4
Disk (/run/media/tom/Data): 909,57 MiB / 937,62 GiB (0%) - ext4
Looks like the wrong arch is detected by rollup
solid-app on ī‚  main [!+?] via .NET via īœ˜ v22.5.1 via :snowflake: impure (nix-shell-env)
āÆ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
solid-app on ī‚  main [!+?] via .NET via īœ˜ v22.5.1 via :snowflake: impure (nix-shell-env)
āÆ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
AlexErrant
AlexErrantā€¢3mo ago
My proj (https://github.com/AlexErrant/Pentive/) has no problem with https://github.com/rhashimoto/wa-sqlite or https://github.com/open-spaced-repetition/fsrs-browser, the latter of which I built with wasm-bindgen. If you want a minimal project check out the sandbox of that project which is in Solid https://github.com/open-spaced-repetition/fsrs-browser/tree/main/sandbox . To be clear, I've not yet tried running WASM in solid start (or on the server) all my experience is with client-side wasm
Want results from more Discord servers?
Add your server