ประเภทหนัง
ตัวอย่างหนัง Metamask: How to fix “MetaMask no longer injects web3” & “Cannot read properties of undefined (reading ‘toWei’)” errors when using Drizzle for building a Dapp?
Disposal of decentralized application development metamask and sifting problems
As you begin to build the decentralized application (DAPP) with truffle suckers and sift, problems may arise by injecting Metamask web3 and errors when using Drizzle to build a dapp. In this article, we are immersed in frequent problems that can arise and offer solutions to solve them step by step.
Metamask Problems: “Metamask no longer injects Web3”
When the contract is installed on the Ganache local Ethereum network, Metamask does not automatically inject web3 values. This may occur if the bytes of the contract or the gas limit settings occur during development or testing. Here are some possible reasons and solutions:
- Changes in the contract bytecode or gas limit settings : When you install the contract on ganache, you will use a specific bytecode and gas limit setting. However, when updating the contract code, these values must be changed.
- Missing addictions or variables
: Make sure that all necessary addictions and variables are contained in the bytes of the contract.
Solving the problem:
- Check the Ethereum console for changes made during development or testing.
- Check that all the necessary contracts and their dependence are included in the project’s “Build/Contracts” directory.
- Update the contract code with the latest changes in the development environment.
Sitting Problems: Unable to read the properties of indefinite (‘Towei’)
If you sieve to build a dapp, you can find errors related to indefinite reading properties. This may occur if there are problems with the Web3 directory or the “totalsupply” property of the smart contract.
Here are some possible reasons and solutions:
1.
2.
Solving the problem:
- Check the truffle documentation for updates to the Web3 directory or to change the smart contract code.
- Make sure the “totalsupply” property is correctly read in the sifting application.
More troubleshooting steps
- Check the console errors : If problems arise, check the Ethereum console from the metamask and the dripping error messages.
- Check the network connection : Make sure the local ganache network connection is stable and secure.
- Run truffle tests : Run all truffle tests to ensure that they go without problems.
By following these steps and troubleshooting guides, you must be able to solve “Metamask no longer injecting web3” and “cannot read the properties of unspecified reading when using a sieve to build a dapp. If the questions persist, give me more details of your project and its surroundings, and I will be happy to help.