Skip to content

[Bug]: memory-lancedb fails on macOS (pnpm global install) — apache-arrow + native bindings missing #22687

@mahsumaktas

Description

@mahsumaktas

Summary

memory-lancedb extension fails with Cannot find module 'apache-arrow' when OpenClaw is installed globally via npm install -g openclaw on macOS (Apple Silicon).

Root Cause

pnpm workspace hoisting places @lancedb/lancedb under node_modules/.ignored/@lancedb/lancedb/ instead of the standard node_modules/@lancedb/lancedb/ path. This causes Node.js require() to fail at runtime for:

  1. apache-arrow (peer dependency)
  2. flatbuffers (transitive dependency of apache-arrow)
  3. reflect-metadata (used by lancedb embedding registry)
  4. @lancedb/lancedb-darwin-arm64 (native binary, optional dependency)

Additionally, @lancedb/lancedb's package.json exports field doesn't expose ./dist/arrow, which the extension's internal code requires.

Steps to Reproduce

  1. Install OpenClaw globally: npm install -g openclaw
  2. Enable memory-lancedb extension
  3. Try memory_store or memory_recall → fails with:
memory-lancedb: failed to load LanceDB. Error: Cannot find module 'apache-arrow'
Require stack:
- .../extensions/memory-lancedb/node_modules/@lancedb/lancedb/dist/arrow.js

Workaround

Manual copy of missing dependencies into the extension's node_modules:

# 1. Install missing deps in temp dir
cd /tmp && mkdir arrow-fix && cd arrow-fix
npm init -y && npm install apache-arrow flatbuffers reflect-metadata @lancedb/[email protected]

# 2. Copy `.ignored` lancedb to proper path (with -RL to resolve symlinks)
EXT=$(npm root -g)/openclaw/extensions/memory-lancedb/node_modules
cp -RL $EXT/.ignored/@lancedb/lancedb $EXT/@lancedb/lancedb

# 3. Patch exports in package.json
python3 -c "import json;p='$EXT/@lancedb/lancedb/package.json';d=json.load(open(p));d['exports']['./dist/arrow']='./dist/arrow.js';json.dump(d,open(p,'w'),indent=2)"

# 4. Copy deps into lancedb's own node_modules
mkdir -p $EXT/@lancedb/lancedb/node_modules/@lancedb
cp -r /tmp/arrow-fix/node_modules/apache-arrow $EXT/@lancedb/lancedb/node_modules/
cp -r /tmp/arrow-fix/node_modules/flatbuffers $EXT/@lancedb/lancedb/node_modules/
cp -r /tmp/arrow-fix/node_modules/reflect-metadata $EXT/@lancedb/lancedb/node_modules/
cp -r /tmp/arrow-fix/node_modules/@lancedb/lancedb-darwin-arm64 $EXT/@lancedb/lancedb/node_modules/@lancedb/

# 5. Restart gateway
openclaw gateway restart

Environment

  • macOS 15.x (Apple Silicon M4)
  • Node.js v25.6.1
  • OpenClaw v2026.2.19-2 (npm global install)
  • pnpm v10.23.0
  • @lancedb/lancedb v0.26.2

Suggested Fix

  1. Add apache-arrow, flatbuffers, reflect-metadata as explicit dependencies in extensions/memory-lancedb/package.json
  2. Ensure @lancedb/lancedb-darwin-arm64 (and other platform binaries) are included as optionalDependencies
  3. Fix the pnpm .ignored hoisting issue — possibly by using .npmrc with shamefully-hoist=true or explicit pnpm.overrides

Related: #19466 (Docker variant of the same issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions