9.4 KiB
Common Issues & Troubleshooting
Solutions to frequently encountered problems when developing OpenNoodl.
Build Issues
"Module not found" Errors
Symptom: Build fails with Cannot find module '@noodl-xxx/...'
Solutions:
- Run
npm installfrom root directory - Check if package exists in
packages/ - Verify tsconfig paths are correct
- Try:
rm -rf node_modules && npm install
"Peer dependency" Warnings
Symptom: npm install shows peer dependency warnings
Solutions:
- Check if versions are compatible
- Update the conflicting package
- Last resort:
npm install --legacy-peer-deps - Document why in CHANGELOG.md
TypeScript Errors After Update
Symptom: Types that worked before now fail
Solutions:
- Run
npx tsc --noEmitto see all errors - Check if
@types/*packages need updating - Look for breaking changes in updated packages
- Check
tsconfig.jsonfor configuration issues
Webpack Build Hangs
Symptom: Build starts but never completes
Solutions:
- Check for circular imports:
npx madge --circular packages/ - Increase Node memory:
NODE_OPTIONS=--max_old_space_size=4096 - Check for infinite loops in build scripts
- Try building individual packages
Runtime Issues
Hot Reload Not Working
Symptom: Changes don't appear without full restart
Solutions:
- Check webpack dev server is running
- Verify file is being watched (check webpack config)
- Clear browser cache
- Check for syntax errors preventing reload
- Restart dev server:
npm run dev
Node Not Appearing in Picker
Symptom: Created a node but it doesn't show up
Solutions:
- Verify node is exported in
nodelibraryexport.js - Check
categoryis valid - Verify no JavaScript errors in node definition
- Restart the editor
"Cannot read property of undefined"
Symptom: Runtime error accessing object properties
Solutions:
- Add null checks:
obj?.property - Verify data is loaded before access
- Check async timing issues
- Add defensive initialization
State Not Updating
Symptom: Changed input but output doesn't update
Solutions:
- Verify
flagOutputDirty()is called - Check if batching is interfering
- Verify connection exists in graph
- Check for conditional logic preventing update
React Component Not Receiving Events
Symptom: ProjectModel/NodeLibrary events fire but React components don't update
Solutions:
-
Check if using
useEventListenerhook (most common issue):// ✅ RIGHT - Always use useEventListener import { useEventListener } from '@noodl-hooks/useEventListener'; // ❌ WRONG - Direct .on() silently fails in React useEffect(() => { ProjectModel.instance.on('event', handler, {}); }, []); useEventListener(ProjectModel.instance, 'event', handler); -
Check singleton dependency in useEffect:
// ❌ WRONG - Runs once before instance exists useEffect(() => { if (!ProjectModel.instance) return; ProjectModel.instance.on('event', handler, group); }, []); // Empty deps! // ✅ RIGHT - Re-runs when instance loads useEffect(() => { if (!ProjectModel.instance) return; ProjectModel.instance.on('event', handler, group); }, [ProjectModel.instance]); // Include singleton! -
Verify code is loading:
- Add
console.log('🔥 Module loaded')at top of file - If log doesn't appear, clear caches (see Webpack issues below)
- Add
-
Check event name matches exactly:
- ProjectModel events:
componentRenamed,componentAdded,componentRemoved - Case-sensitive, no typos
- ProjectModel events:
See also:
Undo Action Doesn't Execute
Symptom: Action returns success and appears in undo history, but nothing happens
Solutions:
-
Check if using broken pattern:
// ❌ WRONG - Silent failure due to ptr bug const undoGroup = new UndoActionGroup({ label: 'Action' }); UndoQueue.instance.push(undoGroup); undoGroup.push({ do: () => {...}, undo: () => {...} }); undoGroup.do(); // NEVER EXECUTES // ✅ RIGHT - Use pushAndDo UndoQueue.instance.pushAndDo( new UndoActionGroup({ label: 'Action', do: () => {...}, undo: () => {...} }) ); -
Add debug logging:
do: () => { console.log('🔥 ACTION EXECUTING'); // Should print immediately // Your action here }If log doesn't print, you have the ptr bug.
-
Search codebase for broken pattern:
grep -r "undoGroup.push" packages/ grep -r "undoGroup.do()" packages/If these appear together, fix them.
See also:
- UNDO-QUEUE-PATTERNS.md - Complete guide
- LEARNINGS.md - UndoActionGroup
Webpack Cache Preventing Code Changes
Symptom: Code changes not appearing despite save/restart
Solutions:
-
Verify code is loading (add module marker):
// At top of file console.log('🔥 MyFile.ts LOADED - Version 2.0');If this doesn't appear in console, it's a cache issue.
-
Nuclear cache clear (when standard restart fails):
# Kill processes killall node killall Electron # Clear ALL caches rm -rf packages/noodl-editor/node_modules/.cache rm -rf ~/Library/Application\ Support/Electron rm -rf ~/Library/Application\ Support/OpenNoodl # macOS # Restart npm run dev -
Check build timestamp:
- Look for
🔥 BUILD TIMESTAMP:in console - If timestamp is old, caching is active
- Look for
-
Verify in Sources tab:
- Open Chrome DevTools
- Go to Sources tab
- Find your file
- Check if changes are there
See also: LEARNINGS.md - Webpack Caching
Editor Issues
Preview Not Loading
Symptom: Preview panel is blank or shows error
Solutions:
- Check browser console for errors
- Verify viewer runtime is built
- Check for JavaScript errors in project
- Try creating a new empty project
Property Panel Empty
Symptom: Selected node but no properties shown
Solutions:
- Verify node has
inputsdefined - Check
groupvalues are set - Look for errors in property panel code
- Verify node type is registered
Canvas Performance Issues
Symptom: Node graph is slow/laggy
Solutions:
- Reduce number of visible nodes
- Check for expensive render operations
- Verify no infinite update loops
- Profile with Chrome DevTools
Git Issues
Merge Conflicts in package-lock.json
Symptom: Complex conflicts in lock file
Solutions:
- Accept either version
- Run
npm installto regenerate - Commit the regenerated lock file
Large File Warnings
Symptom: Git warns about large files
Solutions:
- Check
.gitignoreincludes build outputs - Verify
node_modulesnot committed - Use Git LFS for large assets if needed
Testing Issues
Tests Timeout
Symptom: Tests hang or timeout
Solutions:
- Check for unresolved promises
- Verify mocks are set up correctly
- Increase timeout if legitimately slow
- Check for infinite loops
Snapshot Tests Failing
Symptom: Snapshot doesn't match
Solutions:
- Review the diff carefully
- If change is intentional:
npm test -- -u - If unexpected, investigate component changes
Debugging Tips
Enable Verbose Logging
// Add to see more info
console.log('[DEBUG]', variable);
// For node execution
this.context.debugLog('Message', data);
Use Chrome DevTools
- Open editor
- Press
Cmd+Option+I(Mac) orCtrl+Shift+I(Windows) - Check Console for errors
- Use Sources for breakpoints
- Use Network for API issues
Inspect Node State
// In browser console
const node = NoodlRuntime.instance.getNodeById('node-id');
console.log(node._internal);
Check Event Flow
// Add listener to see all events
model.on('*', (event, data) => {
console.log('Event:', event, data);
});
Error Messages
"Maximum call stack size exceeded"
Cause: Infinite recursion or circular dependency
Fix:
- Check for circular imports
- Add base case to recursive functions
- Break dependency cycles
"Cannot access before initialization"
Cause: Temporal dead zone with let/const
Fix:
- Check import order
- Move declaration before usage
- Check for circular imports
"Unexpected token"
Cause: Syntax error or wrong file type
Fix:
- Check file extension matches content
- Verify JSON is valid
- Check for missing brackets/quotes
"ENOENT: no such file or directory"
Cause: Missing file or wrong path
Fix:
- Verify file exists
- Check path is correct (case-sensitive)
- Ensure build step completed
Getting Help
- Search this document first
- Check existing task documentation
- Search codebase for similar patterns
- Check GitHub issues
- Ask in community channels
Contributing Solutions
Found a solution not listed here? Add it!
- Edit this file
- Follow the format: Symptom → Solutions
- Include specific commands when helpful
- Submit PR with your addition