TinyGo "package ... is not supported" on the wasm target in CI
TinyGo implements a subset of Go and its standard library. Building for wasm or wasi can fail when code imports a package (reflection-heavy, networking, or os features) that TinyGo does not support on that target.
What this error means
A tinygo build -target wasm step fails with an error that a package or symbol is unsupported, or "interp: ..." / "could not compile" referencing a stdlib import.
# command-line-arguments
tinygo: error: could not compile: package "net/http" is not supported on target wasmCommon causes
An unsupported stdlib package for wasm
Packages that need full OS, networking, or heavy reflection are not implemented in TinyGo for the wasm target, so importing them fails the build.
A feature gated to the host target only
Code that works for a native TinyGo build uses a feature absent on wasm/wasi, surfacing only when you switch the target.
How to fix it
Avoid the unsupported package on wasm
- Identify the package TinyGo names as unsupported.
- Replace it with a wasm-compatible alternative or host imports.
- Gate host-only code behind build tags so the wasm build excludes it.
//go:build !wasm
package app
// host-only code hereTarget wasi if you need more system features
The wasi target supports more of the standard library than wasm; switch targets if your code needs file or environment access.
tinygo build -o app.wasm -target=wasi ./...How to prevent it
- Use only TinyGo-supported packages on the wasm target.
- Gate host-only code with build tags.
- Pick
wasioverwasmwhen you need more stdlib coverage.