Skip to content
Latchkey

wasmedge: Run Wasm and WASI Modules with WasmEdge

wasmedge executes a WebAssembly/WASI module and can AOT-compile it for the CNCF WasmEdge runtime.

WasmEdge is a CNCF runtime common in edge and serverless CI. It runs standard WASI modules and offers its own AOT compiler (wasmedgec) for faster startup.

What it does

wasmedge instantiates and runs a module, calling _start (command) or a named function in --reactor mode. Filesystem and env access are granted with --dir and --env. wasmedge compile (formerly wasmedgec) produces an AOT-optimized artifact.

Common usage

Terminal
wasmedge app.wasm
wasmedge --dir .:. app.wasm arg1
wasmedge --env KEY=value app.wasm
wasmedge --reactor module.wasm add 2 3
wasmedge compile app.wasm app_aot.wasm

Options

FlagWhat it does
--dir <guest:host>Preopen a host directory for WASI
--env <NAME=VALUE>Set a guest environment variable
--reactorCall a named export instead of _start
compile (subcommand)AOT-compile the module for faster startup

In CI

Grant directories with --dir guest:host; like other WASI runtimes, WasmEdge denies filesystem access until you preopen. AOT-compiled artifacts are runtime-version specific, so rebuild them when you bump WasmEdge.

Common errors in CI

"wasmedge: command not found" means the runtime is not installed (use the official install script). "execution failed: unknown import" is a WASI ABI mismatch. "loading failed: magic header not detected" means the input is not a wasm binary. "host function failed: ... permission denied" means a path was not preopened with --dir.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →