Packages
package.json
node_modules/@runanywhere/<pkg>/prebuilds/<platform>-<arch>/. Nothing compiles from source,
so npm ci is the whole staging step. Use npm ci rather than npm install so the committed
lock file decides the tree.
Node 20 or newer, per the package’s own engines field.
The three processes
This is the part with no equivalent in the other SDKs. Electron splits the SDK across process roles, and each role imports a different subpath.
A renderer cannot
require a native addon, so renderer code never imports the package
directly. It uses window.runanywhere, which the preload puts there.
Two backends
NativeBackend loads the addon in the current process. RpcBackend forwards to the utility
host, which is what keeps a heavy model load off the main process.
Control-plane credentials
Optional. Copy.env.example to .env and fill in RUNANYWHERE_BASE_URL and
RUNANYWHERE_API_KEY to initialize in the production environment, which sends org-scoped
telemetry. With both blank the SDK initializes keyless, in development. Either way inference
stays on the machine. Real environment variables win over the file.
Packaging
Native artifacts cannot load from insideapp.asar, so everything under
node_modules/@runanywhere/*/prebuilds/ has to be asarUnpacked. Unpack both by extension
(.node, .dylib, .dll, .so) and by the whole prebuilds/** tree. The tree rule is what
covers QHexRT’s libqnnhtpv81.cat, which is not a loadable image but whose absence makes the
Hexagon skel fail signature verification. That failure reads as a corrupt model rather than a
packaging fault, which is why it is worth getting right the first time.
Unpacking is only half of it. The paths register() computes point inside app.asar, where
Electron’s fs shim makes them look real to JavaScript while the OS loader sees nothing. The
addon path and each plugin path have to be rewritten to app.asar.unpacked before use.
Compute device
CPU. A--gpu flag asks for a CUDA build of the addon first and falls back to the CPU prebuild
when it is absent. The published packages ship no CUDA prebuild, so that fallback is what
happens today unless you supply a CUDA addon yourself.