wasmer run: Run Wasm and WASI Packages
wasmer run executes a WebAssembly module or a named package, with a WASI sandbox you open per directory.
Wasmer is an alternative WASI runtime with a package registry. In CI it runs the same modules as Wasmtime and can pull ready-made packages by name.
What it does
wasmer run instantiates a module and calls its WASI entry point. It accepts a local file path or a registry reference like python/python. Filesystem access is granted with --dir or remapped with --mapdir.
Common usage
wasmer run app.wasm
wasmer run app.wasm --dir .
wasmer run app.wasm --mapdir=/data:./data
wasmer run app.wasm --env KEY=value -- arg1 arg2
wasmer run python/python -- -c "print('hi')"Options
| Flag | What it does |
|---|---|
| --dir <path> | Preopen a host directory for WASI |
| --mapdir <guest:host> | Preopen a host dir under a different guest path |
| --env <NAME=VALUE> | Set a guest environment variable |
| --invoke <func> | Invoke a named exported function |
| -- <args> | Pass the remaining args as argv to the module |
In CI
Use --mapdir when the guest expects an absolute path like /data but the runner stores files relatively. Registry runs need network access; pre-fetch or vendor the module if the CI network is locked down.
Common errors in CI
"failed to run ...: ... Missing export _start" means the module is not a WASI command (it may be a reactor/library). "unknown import" points at a WASI ABI mismatch. "error: failed to open file" usually means the path was not preopened with --dir/--mapdir.