[Help] react native Unable to resolve module crypto ... could not be found

Hi I’m trying to use Moralis on Expo react native.

I created an expo project, then I npm install react react-moralis.

I then input it in the App.js

import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { MoralisProvider } from "react-moralis";

const serverUrl = "https://xxxxxxxxxx.usemoralis.com:2053/server";
const appId = "xxxxxxxxx";
Moralis.start({ serverUrl, appId });

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",

This is the error when I load the app.

Android Bundling failed 3702ms
Unable to resolve module crypto from /home/brian/Programming/my-expo/node_modules/web3-eth-accounts/lib/index.js: crypto could not be found within the project or in these directories:

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  24 | var Method = require('web3-core-method');
  25 | var Account = require('eth-lib/lib/account');
> 26 | var cryp = (typeof global === 'undefined') ? require('crypto-browserify') : require('crypto');
     |                                                                                      ^
  27 | var scrypt = require('scrypt-js');
  28 | var uuid = require('uuid');
  29 | var utils = require('web3-utils');

Need your help how to fix this?

there is a forum thread for react native boilerplate questions: Ethereum React Native Boilerplate Questions

did you install crypto module?

Thanks for your reply @cryptokid . Just checked it, however I couldn’t find the exact problem people are facing. Also I’m not sure if Expo is supported from this post.

Is Expo not supported using Moralis?

I think that I saw in another forum post that we are trying to remove expo dependency because it has some problems (same post that you linked)

@cryptokid When we remove expo dependency does it mean:

A. We will be able to use Expo without issue, or
B. We won’t be able to use Expo?

I don’t know exactly, it is better to ask in that react native specific thread.

Noted thanks @cryptokid for your responses

Hello team, I also facing exactly the same issue. have you got fixed on this issue. Would you mind you share some idea here?

Hey @happyeric77better to ask in Ethereum React Native Boilerplate thread, you can search it. But as far as I know right now you can’t use Expo with the RN Moralis SDK at the momen :raised_hands:

@YosephKS Thank you so much. I have been working all day long with expo and RN moralis SDK.

Ohhh so you managed to figure it out?

@YosephKS Actually I am trying to get it around by bringing walletconnect and moralis into expo project. It is working now only with walletconnect but not for moralis provider. (Ethereum React Native Boilerplate Questions).
It will be very appreciated there is any hint.