web3-react
web3-react copied to clipboard
MetaMask is not installed !
I am getting that error when I refresh the page, do you know the reason
vendors~main.chunk.js:49202 Uncaught (in promise) NoMetaMaskError: MetaMask not installed
at MetaMask.<anonymous> (vendors~main.chunk.js:49202:35)
at Generator.next (<anonymous>)
at vendors~main.chunk.js:49067:67
at new Promise (<anonymous>)
at push../node_modules/@web3-react/metamask/dist/index.js.__awaiter (vendors~main.chunk.js:49046:10)
at vendors~main.chunk.js:49201:53
Ensure that you are not in an incognito tab. Is Metamask exposed at window.ethereum
?
yes, metamask is exposed at window.ethereum
More information would be helpful if you could provide any
I am getting that error when I refresh the page, do you know the reason
vendors~main.chunk.js:49202 Uncaught (in promise) NoMetaMaskError: MetaMask not installed at MetaMask.<anonymous> (vendors~main.chunk.js:49202:35) at Generator.next (<anonymous>) at vendors~main.chunk.js:49067:67 at new Promise (<anonymous>) at push../node_modules/@web3-react/metamask/dist/index.js.__awaiter (vendors~main.chunk.js:49046:10) at vendors~main.chunk.js:49201:53
Try to run front with HTTPS
Using https does not work either. Is there any update on this issue?
setTimeout to init the connector, the reason i guess is when you first load into the page, the ethereum hasn't been injected into the window env yet,so you need to wait for the ethereum to be injected, just in the next event loop, just like this
const { connector } = useWeb3React();
const tryActivate = async () => {
try {
await connector.activate();
} catch (e) {
console.error(e)
}
}
useEffect(() => {
setTimeout(() => {
tryActivate()
}, 0)
}, [])