Open lloy0076 opened 1 year ago
Hah! I forgot one can just download logs as text, here's that log - Chrome's is basically the same:
Metamask's site suggest:
https://docs.metamask.io/wallet/get-started/detect-metamask
if (typeof window.ethereum !== 'undefined') {
console.log('MetaMask is installed!');
}
I adjusted EthProvider.jsx
like this:
It now works a little "better" (but the RPC server complains, nonetheless this is another problem).
I am on Windows.
I have Firefox latest or Chrome latest.
I started Ganache. I configured the Truffle correctly. I ran the tests against the Ganache. I observed that things appeared to be working (when tests run, gas was withdrawn, when the contract deployed, gas was withdrawn, when Ganache was aware of the project, it could tell if/when the contract(s) were deployed).
WHEN I did NOT install the Metamak extension, the React app would:
Dev console on Chrome said: "window.ethereum is undefined".
FireFox was silent.
No gas etc. or transactions recording against Ganache/blockchain.
FIX:
Then witness the React screen!!!!
^^ it works.
BECAUSE it eventually work, I can surmise that it's not my Blockchain test rig that is broken (i.e. Ganache is working as advertised). Because I could install Metamask, and connect it to my local blockchain and it sees the "correct" apparent values, the RPC server (on localhost:7545) seems to be working correctly as a test network.
BECAUSE webpack is/was able to build the app the problem isn't that webpack failed. It's working. Besides, once I installed Metamask, I an see the various react components (and the react dev tools look as I expect).
So it has something to do with the need for Metamask extension to be present?
To verify further, I opened the React app in Edge (which doesn't have the extension installed yet) and again it gives a blank screen but I include a screenshot of the console:
Questions/Suggestions:
truffle unbox react-box
and follow the README instructions?If the answer is (2) then perhaps the README could be adjusted or an FAQ be made. I'm surely not the only one to see this.
ALSO would it be worth adding a catch/Suspense/something that caught a major misconfiguration like this and gave a nicer experience to the end user than a blank screen? I realise that anyone downloading this box should know how to debug/diagnose React/JS errors but it was very surprising to me at first...