'React native crypto stream module is undefined

I'm giving a try with [react-native-crypto][1] in order to learn how to convert nodejs to be used in React Native project in the future. Unfortunately, I couldn't get it running successfully. I've faced an issue with stream is undefined. ERROR TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[0], "stream").Transform.call').

If you have ever faced a similar problem, I'm so grateful for your help.

Also, I attach the screenshot of the issue as the following enter image description here



Solution 1:[1]

I have figured it out by editing in metro.config.js as the following:

resolver: {
    extraNodeModules: {
      stream: require.resolve('stream-browserify'),
    }
  },

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sinal