我正在尝试使用 expo 和 react-native 构建一个移动应用程序,我有一个屏幕,我需要在其中为用户生成密码,我正在使用 react-native-bip39 来做到这一点。
安装以下软件包后:react-native-bip39、react-native-crypto 和 react-native-randombytes,我有一个错误说:
无法解析module
stream
经过一番挖掘,我了解到我可以使用 rn-nodeify 来安装丢失的软件包,但是当我安装它时,会产生以下错误,我似乎无法找到解决方案:
TypeError:null 不是 node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 中 node_modules/react-native/Libraries/Core/ExceptionsManager.js 中的 node_modules/react-native/Core/ExceptionsManager.js 中的对象(评估'RNRandomBytes.seed'): 172:19 在 node_modules/react-native/Libraries/Core/setUpErrorHandling.js 的 handleException 中:24:6 在 node_modules/@react-native/polyfills/error-guard.js 的 handleError 中:在 node_modules 的 ErrorUtils.reportFatalError 中的 49:36 /metro-runtime/src/polyfills/require.js:204:6 在 guardedLoadModule 中http://192.168.18.160:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:222696 :3在全球代码中
其次是终端上的另一个:
不变违规:“main”尚未注册。在以下情况下可能会发生这种情况: Metro(本地开发服务器)从错误的文件夹运行。检查 Metro 是否正在运行,将其停止并在当前项目中重新启动。一个module由于错误而未能加载并且
AppRegistry.registerComponent
未被调用。在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 在 node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 在 node_modules/react-native/Libraries/Core 的 handleException 中/setUpErrorHandling.js:24:6 in handleError at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
根文件夹下有个shim.js
rn-nodeify生成的文件,package.json有更多同一个工具安装的依赖。
我该如何解决这个问题?