ai / nanoid

A tiny (124 bytes), secure, URL-friendly, unique string ID generator for JavaScript
https://zelark.github.io/nano-id-cc/
MIT License
24.33k stars 788 forks source link

ReferenceError: Can't find variable: crypto #382

Closed onbrdsolutions closed 2 years ago

onbrdsolutions commented 2 years ago

Getting this error when trying to use nanoid. Its a react native expo app connecting to firebase also using node.js

Any ideas on what could be causing it???

ReferenceError: Can't find variable: crypto at node_modules\react-native\Libraries\LogBox\LogBox.js:149:8 in registerError at node_modules\react-native\Libraries\LogBox\LogBox.js:60:8 in errorImpl at node_modules\react-native\Libraries\LogBox\LogBox.js:34:4 in console.error at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException at node_modules\react-native\Libraries\Core\ExceptionsManager.js:172:19 in handleException at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:44:19 in errorHandler at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:49:24 in at node_modules\@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError at node_modules\metro-runtime\src\polyfills\require.js:204:6 in guardedLoadModule at http://192.168.0.119:19000/index.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:369014:3 in global code

onbrdsolutions commented 2 years ago

Silly me I never import "react-native-get-random-values". What a waste on KBs with the issue