mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 22:53:17 +09:00
Fixes ERR_MODULE_NOT_FOUND error when using npx claude-flow@alpha
## Problem
AgentDB v1.3.9 has missing .js extensions in controller imports:
```javascript
// node_modules/agentdb/dist/controllers/index.js
export { ReflexionMemory } from './ReflexionMemory'; // ❌ Missing .js
```
This causes MODULE_NOT_FOUND errors in ESM environments, especially
when using npx which gets fresh installs without local patches.
## Solution
Added automatic postinstall patch that fixes AgentDB imports:
1. **patches/agentdb-fix-imports.patch** - Patch definition
2. **scripts/fix-agentdb-imports.sh** - Auto-apply script
3. **package.json** - Updated postinstall to run fix
The fix is applied automatically on:
- npm install
- npm update
- npx claude-flow@alpha (fresh installs)
## Changes
- Added patches/agentdb-fix-imports.patch
- Added scripts/fix-agentdb-imports.sh (executable)
- Updated package.json postinstall script
## Testing
✅ Verified locally with npx claude-flow@alpha memory list
✅ Import errors resolved
✅ All memory commands working
## Note
This is a temporary workaround until agentdb@1.3.9 is fixed upstream.
The patch adds .js extensions to ESM imports:
- ReflexionMemory.js
- SkillLibrary.js
- EmbeddingService.js
🚀 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
19 lines
660 B
Bash
Executable File
19 lines
660 B
Bash
Executable File
#!/bin/bash
|
|
# Fix AgentDB missing .js extensions in imports
|
|
# This is a workaround until agentdb@1.3.9 is fixed upstream
|
|
|
|
AGENTDB_INDEX="node_modules/agentdb/dist/controllers/index.js"
|
|
|
|
if [ -f "$AGENTDB_INDEX" ]; then
|
|
echo "🔧 Fixing AgentDB import extensions..."
|
|
|
|
# Fix missing .js extensions
|
|
sed -i "s/from '\.\/ReflexionMemory'/from '.\/ReflexionMemory.js'/g" "$AGENTDB_INDEX"
|
|
sed -i "s/from '\.\/SkillLibrary'/from '.\/SkillLibrary.js'/g" "$AGENTDB_INDEX"
|
|
sed -i "s/from '\.\/EmbeddingService'/from '.\/EmbeddingService.js'/g" "$AGENTDB_INDEX"
|
|
|
|
echo "✅ AgentDB imports fixed"
|
|
else
|
|
echo "⚠️ AgentDB not installed, skipping patch"
|
|
fi
|