MoralisWeb3 / Moralis-JS-SDK

Moralis Official Javascript SDK
https://docs.moralis.io
Other
366 stars 257 forks source link

Error: undefined Unable to resolve module moralis/common-evm-utils in React-Native project #1124

Closed chachaxw closed 1 year ago

chachaxw commented 1 year ago

New Bug Report

Checklist

Issue Description

I got this error when I tried to use @moralisweb3/react in my project, I have installed moralis and @moralisweb3/react, but I still got this error.

 ERROR  [Error: undefined Unable to resolve module moralis/common-evm-utils from /Users/chacha/Develop/lenstalk-app/node_modules/@moralisweb3/react/lib/hooks/evmApi/generated/useEvmContractEvents.js: moralis/common-evm-utils could not be found within the project or in these directories:
  node_modules
  53 | exports.useEvmContractEvents = void 0;
  54 | var moralis_1 = __importDefault(require("moralis"));
> 55 | var common_evm_utils_1 = require("moralis/common-evm-utils");
     |                                   ^
  56 | var react_1 = require("react");
  57 | var utils_1 = require("../../utils");
  58 | var validateParams_1 = require("../../../utils/validateParams");]

I checked node_modules, there's a lot of @moralisweb3 modules. Can someone help me?

Screenshot 2023-05-14 at 21 37 48

Steps + code to reproduce

IMG_2404

Just installed these packages in react-native project, and it will reproduce the issue.

  // package.json
  "@moralisweb3/common-core": "^2.20.0",
  "@moralisweb3/common-sol-utils": "^2.20.0",
  "@moralisweb3/evm-api": "^2.20.0",
  "@moralisweb3/react": "^2.20.0",

Actual Outcome

Expected Outcome

Environment

Server

Client

Logs

b4rtaz commented 1 year ago

Hi @chachaxw!

The @moralisweb3/react package has never tested with React Native. We didn't recommend to use this package for React Native.

Anyway, you may try to use just the moralis package, instead of the @moralisweb3/react.

b4rtaz commented 1 year ago

@chachaxw Have you solved the problem?

chachaxw commented 1 year ago

@b4rtaz Yeah, I have solved this problem, and it seems the latest version support react native now.