I have followed NFT collections owned by an address
But when i run test.js below
(i did replace my api key)
import Moralis from 'moralis';
import { EvmChain } from '@moralisweb3/evm-utils';
try {
const address = '0x42C06BEFb799ad2aBC95E592d3d81c8416C39E08';
const chain = EvmChain.ETHEREUM;
await Moralis.start({
apiKey: 'my api key',
// ...and any other configuration
});
const response = await Moralis.EvmApi.nft.getWalletNFTs({
address,
chain,
});
console.log(response?.result);
} catch (e) {
console.error(e);
}
I get the following error in console
node test.js
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@moralisweb3/evm-utils' imported from W:\Web\MoralisApi\test.js
at new NodeError (node:internal/errors:399:5)
at packageResolve (node:internal/modules/esm/resolve:889:9)
at moduleResolve (node:internal/modules/esm/resolve:938:20)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
My package.json is:-
{
"dependencies": {
"@moralisweb3/common-evm-utils": "^2.14.1",
"moralis": "^2.14.1"
},
"main": "test.js",
"type": "module"
}
PS: I am new to node js