Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

329
Vistas
How do I resolve 'Null is not an object' error when evaluating RNRandomBytes.seed

I'm trying to build a mobile application with expo and react-native, I have a screen where I need to generate a passphrase for the user and I'm using react-native-bip39 in order to do that.

After installing the following packages: react-native-bip39, react-native-crypto and react-native-randombytes, I had an error that says:

Unable to resolve module stream

After doing some digging, I understood that I could use rn-nodeify to install the missing packages, however when I did install it, the following error has been generated and I can't seem to find a solution for it:

TypeError: null is not an object (evaluating 'RNRandomBytes.seed') 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/@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.18.160:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:222696:3 in global code

Followed by another one on the terminal:

Invariant Violation: "main" has not been registered. This can happen if: Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project. A module failed to load due to an error and AppRegistry.registerComponent wasn't called. 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/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError

There is a shim.js file generated by rn-nodeify in the root folder, and package.json has more dependencies installed by the same tool.

How can I resolve this issue?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I had the same problem and after some research, this is what did work for me:

1- Adding buffer and events Error: Unable to resolve module `buffer` React Native

2- Seed problem: switch from react-native-randombytes to react-native-get-random-values TypeError: null is not an object (evaluating 'RNRandomBytes.seed') React Native

3- Fix stream problem in cipher-base with readable-stream by adding 'patch-package' https://github.com/crypto-browserify/cipher-base/issues/10

And finally this is how I implemented the solution in a custom hook to get my random words :

import { useState, useEffect } from "react";
import "react-native-get-random-values";
import { entropyToMnemonic } from "bip39";

export default function UseBip39() {
  const [state, setState] = useState([]);

  useEffect(() => {
    async function generateWords() {
      const entropy = await crypto.getRandomValues(new Uint8Array(16));
      setState(entropyToMnemonic(entropy).split(" "));
    }
    generateWords();
  }, []);

  return state;
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda