localStorage is not defined


How I can fix the error in NodeJs v14.18.0:

(node:13724) UnhandledPromiseRejectionWarning: ReferenceError: localStorage is not defined

Got this error when try to use method getLogsByAddress:

import Moralis from 'moralis/dist/moralis.min.js';
Moralis.start({serverUrl, appId});
oLogs = await Moralis.Web3API.native.getLogsByAddress(oParams);


maybe you need to import moralis/node:

1 Like

Thanks for this. Correct way:

import Moralis from β€˜moralis/node.js’;