Error DictionaryLast Updated: Jan 31, 2026

Fix: Cannot find module 'sharp' or 'better-sqlite3'

Step-by-step fix for 'Cannot find module' errors when running OpenClaw after installation.

This page helps you fix missing native module errors when starting OpenClaw.


🔴 Raw Error Log (What You Actually See)

When you run npm run start, you see:

Error: Cannot find module 'sharp'
Require stack:
- /path/to/OpenClaw/node_modules/...
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)

Or:

Error: Cannot find module 'better-sqlite3'

Or:

Error: The module was compiled against a different Node.js version

If your error looks similar, you are in the right place.


🔍 Why This Happens (Root Cause)

These are native modules compiled specifically for your operating system and Node.js version.

The error occurs when:

  1. The binary failed to download during npm install
  2. The binary was compiled for a different architecture (e.g., x64 vs. ARM)
  3. You switched Node.js versions after installing

✅ How to Fix It (Step-by-Step)

Step 1 — Clean Install Everything

rm -rf node_modules
rm package-lock.json
npm install

Step 2 — If Still Failing, Rebuild Native Modules

npm rebuild

Step 3 — For Apple Silicon (M1/M2/M3) Users

If you're on Apple Silicon and still having issues:

# Reinstall sharp specifically for your architecture
npm install --platform=darwin --arch=arm64 sharp

# Then reinstall everything
npm install

Step 4 — For Node Version Mismatch

If you recently changed Node.js versions:

# Ensure you're using the right version
node -v

# Clean and reinstall
rm -rf node_modules
npm install

🔎 Verify the Fix

After applying the fix, run:

npm run start

✅ Expected Result

OpenClaw starts without module errors:

> OpenClaw@1.0.0 start
> node server.js

Server running on http://localhost:3000
OpenClaw is ready! 🚀

❌ Still Not Working?


🧭 Advanced Notes

Using Docker?

Native modules can be tricky in Docker. Make sure your Dockerfile includes:

# Install build dependencies
RUN apk add --no-cache python3 make g++

# Then install npm packages
RUN npm install

🔗 Related: Common Errors Summary | Error Dictionary

Internal Ref: ERROR_RUNTIME_002
ErrorRuntimeModulesharpbetter-sqlite3