Hi, I have a question error moralis-v1 [react native]

Hello, I have this error that I get when configuring a new project with expo, I have read several solutions applied apparently from webpack 5 and nothing, I run the project but when compiling to production it does not do it due to the errors. I attach the error and the package

ERROR in ./node_modules/@toruslabs/eccrypto/browser.js:9
Module not found: Can't resolve 'crypto'
   7 | var subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;
   8 |
>  9 | var nodeCrypto = require('crypto');
  10 |
  11 | const EC_GROUP_ORDER = Buffer.from('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 'hex');
  12 | const ZERO32 = Buffer.alloc(32, 0);

ERROR in ./node_modules/jsonschema/lib/helpers.js:3
Module not found: Can't resolve 'url'
  1 | 'use strict';
  2 |
> 3 | var uri = require('url');
  4 |
  5 | var ValidationError = exports.ValidationError = function ValidationError (message, instance, schema, path, name, argument) {
  6 |   if(Array.isArray(path)){

ERROR in ./node_modules/jsonschema/lib/scan.js:3
Module not found: Can't resolve 'url'
  1 | "use strict";
  2 |
> 3 | var urilib = require('url');
  4 | var helpers = require('./helpers');
  5 |
  6 | module.exports.SchemaScanResult = SchemaScanResult;

ERROR in ./node_modules/jsonschema/lib/validator.js:3
Module not found: Can't resolve 'url'
  1 | 'use strict';
  2 |
> 3 | var urilib = require('url');
  4 |
  5 | var attribute = require('./attribute');
  6 | var helpers = require('./helpers');

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js:1
Module not found: Can't resolve 'http'

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js:2
Module not found: Can't resolve 'https'

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js:3
Module not found: Can't resolve 'os'

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js:4
Module not found: Can't resolve 'url'

web compiled with 8 errors and 118 warnings
{

  "name": "templatetest",

  "version": "1.0.0",

  "main": "node_modules/expo/AppEntry.js",

  "scripts": {

    "start": "expo start",

    "android": "expo start --android",

    "ios": "expo start --ios",

    "web": "expo start --web"

  },

  "dependencies": {

    "@emotion/react": "^11.10.6",

    "@emotion/styled": "^11.10.6",

    "@fontsource/roboto": "^4.5.8",

    "@mui/icons-material": "^5.11.9",

    "@mui/material": "^5.11.10",

    "@walletconnect/web3-provider": "^1.8.0",

    "@web3auth/web3auth": "^2.1.3",

    "expo": "~47.0.12",

    "expo-status-bar": "~1.4.2",

    "magic-sdk": "^13.4.0",

    "moralis-v1": "^1.12.0",

    "react": "18.1.0",

    "react-dom": "18.1.0",

    "react-moralis": "^1.4.2",

    "react-native": "0.70.5",

    "react-native-web": "~0.18.9",

    "react-router-dom": "^6.8.1",

    "stream": "^0.0.2"

  },

  "devDependencies": {

    "@babel/core": "^7.12.9",

    "@types/react": "~18.0.14",

    "@types/react-native": "~0.70.6",

    "typescript": "^4.6.3"

  },

  "private": true

}

Hi @davidzuccarini

It might not be related to v1-sdk. Do you have any dependency that uses @toruslabs module?

if it comes from moralis-v1 or from a sublibrary of moralis, which when I install only react-moralis I get the error of installing moralis-v1 and when installing moralis-v1 all the errors mentioned above appear, the dependencies that I have are above in the package.

error if I don’t have moralis-v1 installed:

ERROR in ./node_modules/react-moralis/lib/index.esm.js 3:0-39
Module not found: Error: Can't resolve 'moralis-v1' in 'C:\Users\david\Documents\Programacion\React_Native\templateTest\node_modules\react-moralis\lib'

web compiled with 1 error

Can you try the solution from the below GitHub issue? In case if you haven’t already tried.

i try that solution didn’t work for me. I don’t know what else I could do. do i share the repo? the error is in web3auth in expo Webpack 5 Polyfills Issue

Hey @davidzuccarini,

I recommend that you do not use moralis-v1 for React Native any further as the software was deprecated and it was in alpha stage, meaning it was not fully production ready like the JS/React SDK (that is also has been deprecated).

On further note, looks like from your error, your issue is on different webpack versions. I suggest that you look into overriding solution such as react-app-rewired to set the webpack version of your project to v5.

Thanks for the information, I understand, should I use react-moralis? If so, the library I use is react-moralis but when installing react moralis it asks me to install moralis-v1

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.