[RESOLVED] Error While using Moralis with react vite

Uncaught ReferenceError: global is not defined
    at node_modules/randombytes/browser.js (browser.js:16:14)
    at __require (chunk-AC2VUBZ6.js?v=c6395feb:11:50)
    at node_modules/ethereum-cryptography/random.js (random.ts:1:21)
    at __require (chunk-AC2VUBZ6.js?v=c6395feb:11:50)
    at node_modules/ethereum-cryptography/secp256k1.js (secp256k1.ts:2:1)
    at __require (chunk-AC2VUBZ6.js?v=c6395feb:11:50)
    at node_modules/ethereumjs-util/dist.browser/account.js (account.ts:3:1)
    at __require (chunk-AC2VUBZ6.js?v=c6395feb:11:50)
    at node_modules/ethereumjs-util/dist.browser/index.js (index.ts:9:1)
    at __require (chunk-AC2VUBZ6.js?v=c6395feb:11:50)

This is the error i get while using it

on what command you get that error?

you are using react in backend or in frontend?

1 Like

it shows the error when I enter this command

npm run dev

Yes react in the frontend

It has been resolved

1 Like