"Error: Native module not found" error when using uuidv4 in React Native app (non Expo)
See original GitHub issueDescribe the bug
When I try to use uuidv4 in my vanilla react native (non-Expo) app, I’m getting “Error: Native module not found” error. I’m importing the two needed dependencies correctly as far as I can tell, and the same way worked for my Expo app:
import 'react-native-get-random-values';
import {v4 as uuidv4} from 'uuid';
...
// some where in my render() function
const myID = uuidv4(); // throws error
I’ve verified /node_modules has the two packages downloaded correctly too.
How to reproduce
Basically what I described above - I’m using basically a blank RN app.
Expected behavior
uuidv4() should work with react-native-get-random-values
imported above it.
Runtime
- OS: macOS
- Runtime: react-native (non-Expo)
- Runtime Version: 0.64.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:10 (3 by maintainers)
Top Results From Across the Web
"Error: Native module not found" error when using uuidv4 in React ...
Describe the bug. When I try to use uuidv4 in my vanilla react native (non-Expo) app, I'm getting "Error: Native module not found"...
Read more >Can't resolve 'uuid/v4' in react-native - Stack Overflow
Failed to compile. Module not found: Can't resolve 'uuid/v4' in 'F:\App 2nd\chat2\SecreteChat\node_modules\expo-constants ...
Read more >[Solved]-Can't resolve 'uuid/v4' in react-native-React Native
How to resolve React Native iOS linking error:: 'ReactNativeNavigation/ReactNativeNavigation.h' file not found? React Native importing error: unable to resolve ...
Read more >Issue with UUIDv4 : r/reactnative - Reddit
Hey there, new to React Native (working in expo) and running into an issue. Trying to follow Brad Traversy's React Native Crash Course...
Read more >uuid - NPM Package Overview - Socket.dev
Start using Socket to analyze uuid and its 0 dependencies to secure your app ... Webpack and rollup.js module bundlers; React Native /...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is what I would recommend as well 👍
I think we can close this one now since a workaround have been found, there doesn’t seem to be anything we can change in
uuid
, and there hasn’t been any recent activity…I think the fact that a manual
npx pod-install
is currently necessary in order to installreact-native-get-random-values
is something that cannot be fixed inuuid
but would have to be approached in https://github.com/LinusU/react-native-get-random-values, so feel free to raise an issue over there.Until then I think the best bet is to make
react-native-get-random-values
apeerDependency
of your library and document the necessary steps to install it.Maybe one more idea: Have you tried adding
react-native-get-random-values
as a dependency to your library and the necessary manual install steps in apostinstall
hook?