Skip to content

add troubleshooting about metro Invariant Violation#348

Open
radoslawrolka wants to merge 2 commits into
mainfrom
rolkrado/invariant-violation
Open

add troubleshooting about metro Invariant Violation#348
radoslawrolka wants to merge 2 commits into
mainfrom
rolkrado/invariant-violation

Conversation

@radoslawrolka

Copy link
Copy Markdown
Collaborator

📝 Description

example:

1 package may need updating. Run npx expo install --check for details. 
Logs for your project will appear below. Press Ctrl+C to exit. 
<>/react-native-gesture-handler/apps/expo-example/node_modules/@expo/cli/build/src/utils/errors.js:130 throw error; 

Invariant Violation: Detected addition or modification of file node_modules/react-native-screens/.rnrepo-cache/Current, 
but it is tracked as a non-empty directory 
at invariant (<>/react-native-gesture-handler/apps/expo-example/node_modules/invariant/invariant.js:40:15) 
at TreeFS.addOrModify (<>/react-native-gesture-handler/apps/expo-example/node_modules/@expo/metro-file-map/build/lib/TreeFS.js:386:41) 
at Timeout.emitChange [as _onTimeout] (<>/react-native-gesture-handler/apps/expo-example/node_modules/@expo/metro-file-map/build/index.js:580:32) 
at listOnTimeout (node:internal/timers:605:17) 
at process.processTimers (node:internal/timers:541:7) •
 framesToPop: 1 

Node.js v25.8.0 . 

🎯 Type of Change

  • 📚 Documentation update

@kmagiera kmagiera left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried creating .watchmanconfig under each .rnrepo-cache directory to exclude its content? I think watchman should pick it up and ignore not scan the content. This should be simpler than extending the config

@radoslawrolka

Copy link
Copy Markdown
Collaborator Author

Watchman only applies the configuration from the project root, so nested .watchmanconfig files are ignored. I’ll remove the .rnrepo-cache exclusion from the troubleshooting section since the fix is usually simple enough (clearing the Metro cache or deleting Watchman state/files).

If someone still runs into persistent issues, ai can add the Watchman exclude configuration too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants