Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./src/utils/web3.js Module not found: Can't resolve 'web3' #5

Open
Sathish-Prabhu opened this issue Mar 18, 2021 · 0 comments
Open

Comments

@Sathish-Prabhu
Copy link

Sathish-Prabhu commented Mar 18, 2021

After executing the npm start command, The localhost starts and after a few seconds this error pops up.

import Web3 from 'web3'

let web3

// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof window !== 'undefined' && typeof window.web3 !== 'undefined') {
// Use Mist/MetaMask's provider.
web3 = new Web3(window.web3.currentProvider)
console.log('Injected web3 detected.')
} else {
// Fallback to localhost if no web3 injection. We've configured this to
// use the development console's port by default.
const provider = new Web3.providers.HttpProvider('http://127.0.0.1:8545')
web3 = new Web3(provider)
console.log('No web3 instance injected, using Local web3.')
}

export default web3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant