web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

MetaMask is not installed !

Open berkaycirak opened this issue 2 years ago • 6 comments

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

berkaycirak avatar Sep 22 '22 10:09 berkaycirak

Ensure that you are not in an incognito tab. Is Metamask exposed at window.ethereum ?

JoeyKhd avatar Sep 22 '22 12:09 JoeyKhd

yes, metamask is exposed at window.ethereum

berkaycirak avatar Sep 22 '22 13:09 berkaycirak

More information would be helpful if you could provide any

JoeyKhd avatar Sep 27 '22 12:09 JoeyKhd

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

pro100skm avatar Oct 20 '22 20:10 pro100skm

Using https does not work either. Is there any update on this issue?

beifeizhou avatar Dec 15 '22 11:12 beifeizhou

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)
    }, [])

AeolusZane avatar May 11 '24 06:05 AeolusZane