Requirements
Node.js
Node.js
- Node.js 16 or later
- npm or yarn package manager
Browser
Browser
- Modern browser with
SharedArrayBuffersupport - Special COOP/COEP headers required (see below)
- Chrome 92+, Firefox 89+, Safari 15.2+, or Edge 92+
Installation
Package Information
Thez3-solver package includes:
- WebAssembly artifact: Pre-compiled Z3 as a WASM module
- TypeScript bindings: High-level and low-level APIs
- Type definitions: Full TypeScript types for IDE support
- Browser and Node.js support: Automatic platform detection
Package Details
Current version: 0.1.0
Z3, theorem, prover, solver, satisfiability, smt
Node.js >= 16 required
Browser Setup
Required Headers
Your web server must send these headers:Development Setup
For local development or static hosting (e.g., GitHub Pages), you can use the coi-serviceworker trick:index.html
Production Setup
For production, configure your web server properly:Manual Import
The package auto-detects your environment, but you can import explicitly:Bundler Configuration
Webpack
When using webpack, ensurez3-built.js is included as a separate script:
webpack.config.js
Vite
Vite should work out of the box with proper headers configured.Verification
Verify your installation:test.js
Troubleshooting
SharedArrayBuffer is not defined
SharedArrayBuffer is not defined
z3-built.js fails to load
z3-built.js fails to load
When using bundlers like webpack, ensure
z3-built.js is included as a separate script file, not bundled into your main application bundle.Module not found errors
Module not found errors
Clear your node_modules and reinstall:
TypeScript errors
TypeScript errors
Ensure your
tsconfig.json includes:Next Steps
Getting Started
Learn the basics with quick examples
API Reference
Explore the complete API
