Iām trying to execture some functions from node.js env.
const Moralis = require(āmoralis/nodeā)
import { utils } from āethersā
import { moralisServer, ABI } from ā./moralisClientā
class MoralisService {
async connectBlockchain() {
try {
await Moralis.start(moralisServer)
const _id =
process.env.ENV == "development"
? Number(process.env.BLOCKCHAIN_TESTNET_ID)
: Number(process.env.BLOCKCHAIN_MAINNET_ID)
const chainId = utils.hexValue(_id)
await Moralis.enableWeb3({
chainId: Number(chainId),
privateKey: process.env.WALLET_PK,
})
return Moralis
} catch (error) {
console.log('err',error)
return false
}
}
errors:
err ReferenceError: window is not defined
at InjectedWeb3Connector.verifyEthereumBrowser (/Users/connected/_dev/test/server/node_modules/moralis/lib/node/Web3Connector/InjectedWeb3Connector.js:66:5)
at InjectedWeb3Connector.activate (/Users/connected/_dev/test/server/node_modules/moralis/lib/node/Web3Connector/InjectedWeb3Connector.js:72:10)
at InternalWeb3Provider.activate (/Users/connected/_dev/test/server/node_modules/moralis/lib/node/InternalWeb3Provider.js:72:30)
at Function.enableWeb3 (/Users/connected/_dev/test/server/node_modules/moralis/lib/node/MoralisWeb3.js:216:45)
any ideas why itās trying to look for browsersā window if I explicitly import node.js version?