Module not found: Error: Can't resolve 'magic-sdk'

How do I fix these errors? I am using webpack 5 with react-rewired-app scripts.

WARNING in ./node_modules/moralis/lib/browser/Web3Connector/MagicWeb3Connector.js 175:38-58
Module not found: Error: Can’t resolve ‘magic-sdk’ in ‘/Users/jasonbiondo/Sites/cash/node_modules/moralis/lib/browser/Web3Connector’

WARNING in ./node_modules/moralis/lib/browser/Web3Connector/WalletConnectWeb3Connector.js 153:54-93
Module not found: Error: Can’t resolve ‘@walletconnect/web3-provider’ in ‘/Users/jasonbiondo/Sites/cash/node_modules/moralis/lib/browser/Web3Connector’

WARNING in ./node_modules/moralis/lib/browser/Web3Connector/Web3AuthConnector.js 162:40-69
Module not found: Error: Can’t resolve ‘@web3auth/web3auth’ in ‘/Users/jasonbiondo/Sites/cash/node_modules/moralis/lib/browser/Web3Connector’

Have you tried installing the magic sdk

yarn add @web3auth/web3auth [email protected]

1 Like

Yes. It just leads to more terminal errors. Any other ideas?

Did you try webpack 4? Those look like warnings and not errors. Is that the latest version for Moralis sdk?

For anyone else… To solve it I installed each package independently and then add this to my webpack

 config.resolve = {
      fallback: {
        fs: false,
        tls: false,
        net: false,
        path: false,
        zlib: false,
        http: false,
        https: false,
        stream: false,
        crypto: false,
        url: false,
        os: false,
        assert: false
      }
    }
4 Likes

This worked for me, thank you. Althought, I did not have to add the fallback config to webpack.config.js

Try yarn add magic-sdk @walletconnect/web3-provider @web3auth/web3auth

This should work

3 Likes

This worked for me !